Class: Decidim::Meetings::LeaveMeeting
- Inherits:
 - 
      Command
      
        
- Object
 - Command
 - Decidim::Meetings::LeaveMeeting
 
 
- Defined in:
 - app/commands/decidim/meetings/leave_meeting.rb
 
Overview
This command is executed when the user leaves a meeting.
Instance Method Summary collapse
- 
  
    
      #call  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
Destroys a meeting registration if the meeting has registrations enabled and the registration exists.
 - 
  
    
      #initialize(meeting, user)  ⇒ LeaveMeeting 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
Initializes a LeaveMeeting Command.
 
Constructor Details
#initialize(meeting, user) ⇒ LeaveMeeting
Initializes a LeaveMeeting Command.
meeting - The current instance of the meeting to be left. user - The user leaving the meeting.
      11 12 13 14  | 
    
      # File 'app/commands/decidim/meetings/leave_meeting.rb', line 11 def initialize(meeting, user) @meeting = meeting @user = user end  | 
  
Instance Method Details
#call ⇒ Object
Destroys a meeting registration if the meeting has registrations enabled and the registration exists.
Broadcasts :ok if successful, :invalid otherwise.
      20 21 22 23 24 25 26 27 28 29  | 
    
      # File 'app/commands/decidim/meetings/leave_meeting.rb', line 20 def call return broadcast(:invalid) unless registration @meeting.with_lock do destroy_registration destroy_questionnaire_answers decrement_score end broadcast(:ok) end  |