Sha256: ce3bcab292507557936053bbfc6cfe79f489d231e4392955b4aff47197baac10
Contents?: true
Size: 1.49 KB
Versions: 6
Compression:
Stored size: 1.49 KB
Contents
# frozen_string_literal: true module Decidim module Accountability module Admin # This command is executed when the user changes a Result from the admin # panel. class UpdateResult < Decidim::Commands::UpdateResource include Decidim::Accountability::Admin::HasResultCommand fetch_form_attributes :scope, :category, :parent_id, :title, :description, :start_date, :end_date, :progress, :decidim_accountability_status_id, :external_id, :weight private alias result resource def run_after_hooks link_proposals link_meetings link_projects send_notifications if should_notify_followers? end def send_notifications result.linked_resources(:proposals, "included_proposals").each do |proposal| Decidim::EventsManager.publish( event: "decidim.events.accountability.result_progress_updated", event_class: Decidim::Accountability::ResultProgressUpdatedEvent, resource: result, affected_users: proposal.notifiable_identities, followers: proposal.followers - proposal.notifiable_identities, extra: { progress: result.progress, proposal_id: proposal.id } ) end end def should_notify_followers? result.previous_changes["progress"].present? end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems