Sha256: 809cf63a432a7c0b380281d1a693789011945ba74a4cc1f84f6ccb551d6df4fb

Contents?: true

Size: 1.42 KB

Versions: 7

Compression:

Stored size: 1.42 KB

Contents

# frozen_string_literal: true

module Decidim
  # The controller to show all the last activities in a Decidim Organization.
  class UserActivitiesController < Decidim::ApplicationController
    include Paginable
    include UserGroups
    include FilterResource
    include Flaggable

    helper Decidim::ResourceHelper
    helper_method :activities, :resource_types, :user

    def index
      raise ActionController::RoutingError, "Blocked User" if user&.blocked? && !current_user&.admin?
    end

    private

    def user
      @user ||= current_organization.users.find_by(nickname: params[:nickname])
    end

    def activities
      @activities ||= paginate(
        ActivitySearch.new(
          organization: current_organization,
          user: user,
          current_user: current_user,
          resource_type: "all",
          resource_name: filter.resource_type
        ).run
      )
    end

    def default_filter_params
      { resource_type: nil }
    end

    def resource_types
      @resource_types = %w(Decidim::Proposals::CollaborativeDraft
                           Decidim::Comments::Comment
                           Decidim::Debates::Debate
                           Decidim::Initiative
                           Decidim::Meetings::Meeting
                           Decidim::Blogs::Post
                           Decidim::Proposals::Proposal
                           Decidim::Consultations::Question)
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
decidim-core-0.25.2 app/controllers/decidim/user_activities_controller.rb
decidim-core-0.25.1 app/controllers/decidim/user_activities_controller.rb
decidim-core-0.25.0 app/controllers/decidim/user_activities_controller.rb
decidim-core-0.25.0.rc4 app/controllers/decidim/user_activities_controller.rb
decidim-core-0.25.0.rc3 app/controllers/decidim/user_activities_controller.rb
decidim-core-0.25.0.rc2 app/controllers/decidim/user_activities_controller.rb
decidim-core-0.25.0.rc1 app/controllers/decidim/user_activities_controller.rb