Class: Decidim::RejectGroupInvitation
- Inherits:
-
Rectify::Command
- Object
- Rectify::Command
- Decidim::RejectGroupInvitation
- Defined in:
- app/commands/decidim/reject_group_invitation.rb
Overview
A command with all the business logic to reject an invitation to belong to a group.
Instance Method Summary collapse
-
#call ⇒ Object
Executes the command.
-
#initialize(user_group, user) ⇒ RejectGroupInvitation
constructor
Public: Initializes the command.
Constructor Details
#initialize(user_group, user) ⇒ RejectGroupInvitation
Public: Initializes the command.
user_group - the UserGroup where the user has been invited user - the User that has been invited
11 12 13 14 |
# File 'app/commands/decidim/reject_group_invitation.rb', line 11 def initialize(user_group, user) @user_group = user_group @user = user end |
Instance Method Details
#call ⇒ Object
Executes the command. Broadcasts these events:
-
:ok when everything is valid.
-
:invalid if we couldn’t proceed.
Returns nothing.
22 23 24 25 26 27 28 |
# File 'app/commands/decidim/reject_group_invitation.rb', line 22 def call return broadcast(:invalid) if membership.blank? reject_invitation broadcast(:ok) end |