Class: Decidim::ReportingProposals::Admin::UpdateProposalNote

Inherits:
Command
  • Object
show all
Defined in:
app/commands/decidim/reporting_proposals/admin/update_proposal_note.rb

Overview

A command with all the business logic when a user updates a proposal note.

Instance Method Summary collapse

Constructor Details

#initialize(notes_form, note) ⇒ UpdateProposalNote

Public: Initializes the command.

form - A form object with the params. note - the proposal_note to update.



12
13
14
15
# File 'app/commands/decidim/reporting_proposals/admin/update_proposal_note.rb', line 12

def initialize(notes_form, note)
  @notes_form = notes_form
  @note = note
end

Instance Method Details

#callObject



17
18
19
20
21
22
23
# File 'app/commands/decidim/reporting_proposals/admin/update_proposal_note.rb', line 17

def call
  return broadcast(:invalid) if notes_form.invalid?

  update_proposal_note

  broadcast(:ok, note)
end