Class: Decidim::Meetings::DeclineInvitation
- Inherits:
-
Command
- Object
- Command
- Decidim::Meetings::DeclineInvitation
- Defined in:
- app/commands/decidim/meetings/decline_invitation.rb
Overview
This command is executed when the user declines an invite to the 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) ⇒ DeclineInvitation
constructor
Initializes a DeclineInvitation Command.
Constructor Details
#initialize(meeting, user) ⇒ DeclineInvitation
Initializes a DeclineInvitation Command.
meeting - The current instance of the meeting where user has been invited. user - The user that declines their invitation
11 12 13 14 |
# File 'app/commands/decidim/meetings/decline_invitation.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 |
# File 'app/commands/decidim/meetings/decline_invitation.rb', line 20 def call return broadcast(:invalid) unless can_decline_invitation? decline_invitation broadcast(:ok) end |