Class: Decidim::Conferences::Admin::ConfirmConferenceRegistration

Inherits:
Rectify::Command
  • Object
show all
Defined in:
decidim-conferences/app/commands/decidim/conferences/admin/confirm_conference_registration.rb

Overview

This command is executed when the user joins a conference.

Instance Method Summary collapse

Constructor Details

#initialize(conference_registration, current_user) ⇒ ConfirmConferenceRegistration

Initializes a JoinConference Command.

conference_registration - The registration to be confirmed


11
12
13
14
# File 'decidim-conferences/app/commands/decidim/conferences/admin/confirm_conference_registration.rb', line 11

def initialize(conference_registration, current_user)
  @conference_registration = conference_registration
  @current_user = current_user
end

Instance Method Details

#callObject

Creates a conference registration if the conference has registrations enabled and there are available slots.

Broadcasts :ok if successful, :invalid otherwise.


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

def call
  @conference_registration.with_lock do
    return broadcast(:invalid) unless can_join_conference?

    confirm_registration
    send_email_confirmation
    send_notification_confirmation
  end
  broadcast(:ok)
end