Class: Decidim::Meetings::Admin::InviteUserToJoinMeeting
- Inherits:
-
Command
- Object
- Command
- Decidim::Meetings::Admin::InviteUserToJoinMeeting
- Defined in:
- app/commands/decidim/meetings/admin/invite_user_to_join_meeting.rb
Overview
A command with all the business logic to invite users to join a meeting.
Instance Method Summary collapse
-
#call ⇒ Object
Executes the command.
-
#initialize(form, meeting, invited_by) ⇒ InviteUserToJoinMeeting
constructor
Public: Initializes the command.
Constructor Details
#initialize(form, meeting, invited_by) ⇒ InviteUserToJoinMeeting
Public: Initializes the command.
form - A form object with the params. meeting - The meeting which the user is invited to. invited_by - The user performing the operation
14 15 16 17 18 |
# File 'app/commands/decidim/meetings/admin/invite_user_to_join_meeting.rb', line 14 def initialize(form, meeting, invited_by) @form = form @meeting = meeting @invited_by = invited_by end |
Instance Method Details
#call ⇒ Object
Executes the command. Broadcasts these events:
-
:ok when everything is valid.
-
:invalid if the form was not valid and we could not proceed.
Returns nothing.
26 27 28 29 30 31 32 |
# File 'app/commands/decidim/meetings/admin/invite_user_to_join_meeting.rb', line 26 def call return broadcast(:invalid) if form.invalid? || already_invited? invite_user broadcast(:ok) end |