Sha256: 81ff23822d02ad5b06117ddd0c873dc492e70538ef9740c4bd739810e448ce1e
Contents?: true
Size: 845 Bytes
Versions: 2
Compression:
Stored size: 845 Bytes
Contents
# frozen_string_literal: true module Decidim module ReportingProposals module Admin # A command with all the business logic when a user updates a proposal note. class UpdateProposalNote < Rectify::Command # Public: Initializes the command. # # form - A form object with the params. # note - the proposal_note to update. def initialize(notes_form, note) @notes_form = notes_form @note = note end def call return broadcast(:invalid) if notes_form.invalid? update_proposal_note broadcast(:ok, note) end private attr_reader :notes_form, :note, :proposal def update_proposal_note note.body = notes_form.body note.save! end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems