Class: Decidim::ParticipatoryProcesses::Admin::Moderators

Inherits:
Rectify::Query
  • Object
show all
Defined in:
decidim-participatory_processes/app/queries/decidim/participatory_processes/admin/moderators.rb

Overview

A class used to find the users that can moderate the participatory process.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(process) ⇒ Moderators

Initializes the class.

process - a process that needs to find its process admins


19
20
21
# File 'decidim-participatory_processes/app/queries/decidim/participatory_processes/admin/moderators.rb', line 19

def initialize(process)
  @process = process
end

Class Method Details

.for(process) ⇒ Object

Syntactic sugar to initialize the class and return the queried objects.

process - a process that needs to find its moderators


12
13
14
# File 'decidim-participatory_processes/app/queries/decidim/participatory_processes/admin/moderators.rb', line 12

def self.for(process)
  new(process).query
end

Instance Method Details

#queryObject

Finds organization admins and the users with role admin for the given process.

Returns an ActiveRecord::Relation.


27
28
29
# File 'decidim-participatory_processes/app/queries/decidim/participatory_processes/admin/moderators.rb', line 27

def query
  Decidim::User.where(id: organization_admins + process_users)
end