Sha256: 19b331a1c883759c8f2081db5882a02da557054c6035c6177fd1cb046dde0cd9

Contents?: true

Size: 852 Bytes

Versions: 7

Compression:

Stored size: 852 Bytes

Contents

# frozen_string_literal: true

module Decidim
  # The controller to handle the user's public profile page.
  class ProfilesController < Decidim::ApplicationController
    helper Decidim::Messaging::ConversationHelper

    helper_method :user, :active_content

    def show
      return redirect_to profile_notifications_path(nickname: params[:nickname]) if current_user == user && params[:active].blank?
      return redirect_to profile_path(nickname: params[:nickname]) if current_user != user && params[:active] == "notifications"
    end

    private

    def user
      @user ||= Decidim::User.find_by!(
        nickname: params[:nickname],
        organization: current_organization
      )
    end

    def active_content
      return "following" if current_user != user && params[:active].blank?
      params[:active].presence
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
decidim-core-0.13.1 app/controllers/decidim/profiles_controller.rb
decidim-core-0.12.2 app/controllers/decidim/profiles_controller.rb
decidim-core-0.13.0 app/controllers/decidim/profiles_controller.rb
decidim-core-0.12.1 app/controllers/decidim/profiles_controller.rb
decidim-core-0.13.0.pre1 app/controllers/decidim/profiles_controller.rb
decidim-core-0.12.0 app/controllers/decidim/profiles_controller.rb
decidim-core-0.12.0.pre app/controllers/decidim/profiles_controller.rb