Class: Decidim::Proposals::Admin::ReplyProposalNote
- Inherits:
-
Command
- Object
- Command
- Decidim::Proposals::Admin::ReplyProposalNote
- Includes:
- ProposalNotesMethods
- Defined in:
- app/commands/decidim/proposals/admin/reply_proposal_note.rb
Overview
A command with all the business logic when an admin creates a private note proposal reply.
Instance Method Summary collapse
-
#call ⇒ Object
Executes the command.
-
#initialize(form, parent) ⇒ ReplyProposalNote
constructor
Public: Initializes the command.
Constructor Details
#initialize(form, parent) ⇒ ReplyProposalNote
Public: Initializes the command.
form - A form object with the params. parent - the note to reply.
14 15 16 17 18 |
# File 'app/commands/decidim/proposals/admin/reply_proposal_note.rb', line 14 def initialize(form, parent) @form = form @parent = parent @proposal = parent.proposal end |
Instance Method Details
#call ⇒ Object
Executes the command. Broadcasts these events:
-
:ok when everything is valid, together with the note proposal.
-
:invalid if the form was not valid and we could not proceed.
Returns nothing.
26 27 28 29 30 31 32 33 34 |
# File 'app/commands/decidim/proposals/admin/reply_proposal_note.rb', line 26 def call return broadcast(:invalid) if form.invalid? || invalid_parent? create_proposal_note_reply notify_mentioned broadcast(:ok, proposal_note) end |