Sha256: 98f6ac540fce133cb3e9b937111d45bc58c521b0d9020bb221effd3d8db30608

Contents?: true

Size: 1.38 KB

Versions: 6

Compression:

Stored size: 1.38 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,
          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

6 entries across 6 versions & 1 rubygems

Version Path
decidim-core-0.24.3 app/controllers/decidim/user_activities_controller.rb
decidim-core-0.24.2 app/controllers/decidim/user_activities_controller.rb
decidim-core-0.24.1 app/controllers/decidim/user_activities_controller.rb
decidim-core-0.24.0 app/controllers/decidim/user_activities_controller.rb
decidim-core-0.24.0.rc2 app/controllers/decidim/user_activities_controller.rb
decidim-core-0.24.0.rc1 app/controllers/decidim/user_activities_controller.rb