Class: Decidim::Elections::Admin::UpdateActionStatus
- Inherits:
-
Command
- Object
- Command
- Decidim::Elections::Admin::UpdateActionStatus
- Defined in:
- app/commands/decidim/elections/admin/update_action_status.rb
Overview
This command updates the status of the action and the election if it got changed
Instance Method Summary collapse
-
#call ⇒ Object
Update the statuses of the action and the election if pending message status got changed.
-
#initialize(action) ⇒ UpdateActionStatus
constructor
Public: Initializes the command.
Constructor Details
#initialize(action) ⇒ UpdateActionStatus
Public: Initializes the command.
action - The pending action to be updated
11 12 13 |
# File 'app/commands/decidim/elections/admin/update_action_status.rb', line 11 def initialize(action) @action = action end |
Instance Method Details
#call ⇒ Object
Update the statuses of the action and the election if pending message status got changed.
Broadcasts :ok if successful, :invalid otherwise.
18 19 20 21 22 23 24 25 26 27 |
# File 'app/commands/decidim/elections/admin/update_action_status.rb', line 18 def call return broadcast(:ok) unless action.pending? transaction do update_election_status if action.accepted? end broadcast(:ok) end |