Class: Decidim::AcceptGroupInvitation
- Inherits:
-
Rectify::Command
- Object
- Rectify::Command
- Decidim::AcceptGroupInvitation
- Defined in:
- app/commands/decidim/accept_group_invitation.rb
Overview
A command with all the business logic to accept an invitation to belong to a group.
Instance Method Summary collapse
-
#call ⇒ Object
Executes the command.
-
#initialize(user_group, user) ⇒ AcceptGroupInvitation
constructor
Public: Initializes the command.
Constructor Details
#initialize(user_group, user) ⇒ AcceptGroupInvitation
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/accept_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/accept_group_invitation.rb', line 22 def call return broadcast(:invalid) if membership.blank? accept_invitation broadcast(:ok) end |