Class: Decidim::Conferences::LeaveConference
- Inherits:
 - 
      Decidim::Command
      
        
- Object
 - Decidim::Command
 - Decidim::Conferences::LeaveConference
 
 
- Defined in:
 - app/commands/decidim/conferences/leave_conference.rb
 
Overview
This command is executed when the user leaves a conference.
Instance Method Summary collapse
- 
  
    
      #call  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
Destroys a conference registration if the conference has registrations enabled and the registration exists.
 - 
  
    
      #initialize(conference, registration_type, user)  ⇒ LeaveConference 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
Initializes a LeaveConference Command.
 
Constructor Details
#initialize(conference, registration_type, user) ⇒ LeaveConference
Initializes a LeaveConference Command.
conference - The current instance of the conference to be left. registration_type - The registration type selected to attend the conference user - The user leaving the conference.
      12 13 14 15 16  | 
    
      # File 'app/commands/decidim/conferences/leave_conference.rb', line 12 def initialize(conference, registration_type, user) @conference = conference @registration_type = registration_type @user = user end  | 
  
Instance Method Details
#call ⇒ Object
Destroys a conference registration if the conference has registrations enabled and the registration exists.
Broadcasts :ok if successful, :invalid otherwise.
      22 23 24 25 26 27 28 29 30 31  | 
    
      # File 'app/commands/decidim/conferences/leave_conference.rb', line 22 def call return broadcast(:invalid) unless registration return broadcast(:invalid) unless meetings_registrations @conference.with_lock do destroy_registration destroy_meeting_registration end broadcast(:ok) end  |