Class: Decidim::Admin::ParticipatorySpace::UnpublishAllMembers

Inherits:
Command
  • Object
show all
Defined in:
app/commands/decidim/admin/participatory_space/unpublish_all_members.rb

Instance Method Summary collapse

Constructor Details

#initialize(participatory_space, current_user) ⇒ UnpublishAllMembers

Public: Initializes the command.

participatory_space - the participatory space current_user - the current user



11
12
13
14
# File 'app/commands/decidim/admin/participatory_space/unpublish_all_members.rb', line 11

def initialize(participatory_space, current_user)
  @participatory_space = participatory_space
  @current_user = current_user
end

Instance Method Details

#callObject

Executes the command. Broadcasts these events:

  • :ok when everything is valid.

  • :invalid if the form was not valid and we could not proceed.

Returns nothing.



22
23
24
25
26
27
28
# File 'app/commands/decidim/admin/participatory_space/unpublish_all_members.rb', line 22

def call
  unpublish_all
  create_action_log
  broadcast(:ok)
rescue ActiveRecord::RecordInvalid
  broadcast(:invalid)
end