Class: Decidim::Meetings::JoinMeeting
- Inherits:
-
Rectify::Command
- Object
- Rectify::Command
- Decidim::Meetings::JoinMeeting
- Defined in:
- decidim-meetings/app/commands/decidim/meetings/join_meeting.rb
Overview
This command is executed when the user joins a meeting.
Instance Method Summary collapse
-
#call ⇒ Object
Creates a meeting registration if the meeting has registrations enabled and there are available slots.
-
#initialize(meeting, user) ⇒ JoinMeeting
constructor
Initializes a JoinMeeting Command.
Constructor Details
#initialize(meeting, user) ⇒ JoinMeeting
Initializes a JoinMeeting Command.
meeting - The current instance of the meeting to be joined. user - The user joining the meeting.
11 12 13 14 |
# File 'decidim-meetings/app/commands/decidim/meetings/join_meeting.rb', line 11 def initialize(meeting, user) @meeting = meeting @user = user end |
Instance Method Details
#call ⇒ Object
Creates a meeting registration if the meeting has registrations enabled and there are available slots.
Broadcasts :ok if successful, :invalid otherwise.
20 21 22 23 24 25 26 27 28 |
# File 'decidim-meetings/app/commands/decidim/meetings/join_meeting.rb', line 20 def call meeting.with_lock do return broadcast(:invalid) unless can_join_meeting? create_registration send_email_confirmation send_notification end broadcast(:ok) end |