Class: Decidim::Meetings::UpdateMeeting
- Inherits:
-
Command
- Object
- Command
- Decidim::Meetings::UpdateMeeting
- Defined in:
- app/commands/decidim/meetings/update_meeting.rb
Overview
This command is executed when the user changes a Meeting from the admin panel.
Instance Method Summary collapse
-
#call ⇒ Object
Updates the meeting if valid.
-
#initialize(form, meeting) ⇒ UpdateMeeting
constructor
Initializes a UpdateMeeting Command.
Constructor Details
#initialize(form, meeting) ⇒ UpdateMeeting
Initializes a UpdateMeeting Command.
form - The form from which to get the data. meeting - The current instance of the page to be updated.
13 14 15 16 |
# File 'app/commands/decidim/meetings/update_meeting.rb', line 13 def initialize(form, meeting) @form = form @meeting = meeting end |
Instance Method Details
#call ⇒ Object
Updates the meeting if valid.
Broadcasts :ok if successful, :invalid otherwise.
21 22 23 24 25 26 27 28 29 30 31 |
# File 'app/commands/decidim/meetings/update_meeting.rb', line 21 def call return broadcast(:invalid) if form.invalid? with_events(with_transaction: true) do update_meeting! end send_notification if should_notify_followers? schedule_upcoming_meeting_notification if start_time_changed? broadcast(:ok, meeting) end |