Sha256: 233cdcbde686a86d6fb5bae0038b49a160ebafc47f24ee069c438fec61c48d0d
Contents?: true
Size: 1.44 KB
Versions: 7
Compression:
Stored size: 1.44 KB
Contents
# frozen_string_literal: true module Decidim module Votings module Admin # A command with the business logic to destroy a monitoring committee member class DestroyMonitoringCommitteeMember < Decidim::Command # Public: Initializes the command. # # monitoring_committee_member - the MonitoringCommitteeMember to destroy # current_user - the user performing this action def initialize(monitoring_committee_member, current_user) @monitoring_committee_member = monitoring_committee_member @current_user = current_user end # 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. def call destroy_monitoring_committee_member! broadcast(:ok) end private attr_reader :monitoring_committee_member, :current_user def destroy_monitoring_committee_member! extra_info = { resource: { title: monitoring_committee_member.user.name } } Decidim.traceability.perform_action!( "delete", monitoring_committee_member, current_user, extra_info ) do monitoring_committee_member.destroy! end end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems