Class: Decidim::Meetings::Admin::UpdateRegistrations

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

Overview

This command is executed when the user updates the meeting registrations.

Instance Method Summary collapse

Constructor Details

#initialize(form, meeting) ⇒ UpdateRegistrations

Initializes a UpdateRegistrations Command.

form - The form from which to get the data. meeting - The current instance of the meeting to be updated.



12
13
14
15
# File 'app/commands/decidim/meetings/admin/update_registrations.rb', line 12

def initialize(form, meeting)
  @form = form
  @meeting = meeting
end

Instance Method Details

#callObject

Updates the meeting if valid.

Broadcasts :ok if successful, :invalid otherwise.



20
21
22
23
24
25
26
27
28
29
# File 'app/commands/decidim/meetings/admin/update_registrations.rb', line 20

def call
  return broadcast(:invalid) if form.invalid?

  meeting.with_lock do
    update_meeting_registrations
    send_notification if should_notify_followers?
  end

  broadcast(:ok)
end