Class: Decidim::Meetings::CreateMeeting

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

Overview

This command is executed when a participant or user group creates a Meeting from the public views.

Instance Method Summary collapse

Constructor Details

#initialize(form) ⇒ CreateMeeting

Returns a new instance of CreateMeeting.



8
9
10
# File 'app/commands/decidim/meetings/create_meeting.rb', line 8

def initialize(form)
  @form = form
end

Instance Method Details

#callObject

Creates the meeting if valid.

Broadcasts :ok if successful, :invalid otherwise.



15
16
17
18
19
20
21
22
23
24
25
26
# File 'app/commands/decidim/meetings/create_meeting.rb', line 15

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

  transaction do
    create_meeting!
    schedule_upcoming_meeting_notification
    send_notification
  end

  create_follow_form_resource(form.current_user)
  broadcast(:ok, meeting)
end