Class: Decidim::Conferences::JoinConference
- Inherits:
-
Decidim::Command
- Object
- Decidim::Command
- Decidim::Conferences::JoinConference
- Defined in:
- app/commands/decidim/conferences/join_conference.rb
Overview
This command is executed when the user joins a conference.
Instance Method Summary collapse
-
#call ⇒ Object
Creates a conference registration if the conference has registrations enabled and there are available slots.
-
#initialize(conference, registration_type, user) ⇒ JoinConference
constructor
Initializes a JoinConference Command.
Constructor Details
#initialize(conference, registration_type, user) ⇒ JoinConference
Initializes a JoinConference Command.
conference - The current instance of the conference to be joined. registration_type - The registration type selected to attend the conference user - The user joining the conference.
12 13 14 15 16 |
# File 'app/commands/decidim/conferences/join_conference.rb', line 12 def initialize(conference, registration_type, user) @conference = conference @registration_type = registration_type @user = user end |
Instance Method Details
#call ⇒ Object
Creates a conference registration if the conference has registrations enabled and there are available slots.
Broadcasts :ok if successful, :invalid otherwise.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'app/commands/decidim/conferences/join_conference.rb', line 22 def call return broadcast(:invalid) unless can_join_conference? return broadcast(:ok) if already_joined_conference? conference.with_lock do create_registration create_meetings_registrations accept_invitation send_email_pending_validation send_notification_pending_validation notify_admin_over_percentage end broadcast(:ok) end |