Class: Decidim::LastActivity

Inherits:
Query
  • Object
show all
Defined in:
decidim-core/app/queries/decidim/last_activity.rb

Overview

This query finds the public ActionLog entries that can be shown in the activities views of the application within a Decidim Organization. It is intended to be used in the “Last activities” content block in the homepage, and also in the “Last activities” page, to retrieve public activity of this organization.

Instance Method Summary collapse

Constructor Details

#initialize(organization) ⇒ LastActivity

Returns a new instance of LastActivity.



10
11
12
# File 'decidim-core/app/queries/decidim/last_activity.rb', line 10

def initialize(organization)
  @organization = organization
end

Instance Method Details

#queryObject



14
15
16
17
18
19
20
21
22
# File 'decidim-core/app/queries/decidim/last_activity.rb', line 14

def query
  ActionLog
    .where(
      organization: @organization,
      visibility: %w(public-only all)
    )
    .with_new_resource_type("all")
    .order(created_at: :desc)
end