Class: Decidim::Conferences::Admin::InviteUserToJoinConference
- Inherits:
-
Decidim::Command
- Object
- Decidim::Command
- Decidim::Conferences::Admin::InviteUserToJoinConference
- Defined in:
- decidim-conferences/app/commands/decidim/conferences/admin/invite_user_to_join_conference.rb
Overview
A command with all the business logic to invite users to join a conference.
Instance Method Summary collapse
-
#call ⇒ Object
Executes the command.
-
#initialize(form, conference, invited_by) ⇒ InviteUserToJoinConference
constructor
Public: Initializes the command.
Methods inherited from Decidim::Command
call, #evaluate, #method_missing, #respond_to_missing?, #transaction, #with_events
Constructor Details
#initialize(form, conference, invited_by) ⇒ InviteUserToJoinConference
Public: Initializes the command.
form - A form object with the params. conference - The conference which the user is invited to. invited_by - The user performing the operation
14 15 16 17 18 |
# File 'decidim-conferences/app/commands/decidim/conferences/admin/invite_user_to_join_conference.rb', line 14 def initialize(form, conference, invited_by) @form = form @conference = conference @invited_by = invited_by end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Decidim::Command
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 'decidim-conferences/app/commands/decidim/conferences/admin/invite_user_to_join_conference.rb', line 26 def call return broadcast(:invalid) if form.invalid? || already_invited? invite_user broadcast(:ok) end |