Sha256: 2ff0f41d623a8a8ed2c1e2bd40e40be5ff47802d3531bdaa9c43e321384735c2
Contents?: true
Size: 1.35 KB
Versions: 12
Compression:
Stored size: 1.35 KB
Contents
# frozen_string_literal: true module Decidim module ParticipatoryProcesses module Admin # A command with all the business logic when destroying a participatory # process type in the system. class DestroyParticipatoryProcessType < Decidim::Command # Public: Initializes the command. # # participatory_process_type - A participatory_process_type object to # destroy # current_user - the user performing the action def initialize(participatory_process_type, current_user) @participatory_process_type = participatory_process_type @current_user = current_user end # Executes the command. Broadcasts these events: # # - :ok when everything is valid. # - :invalid if the form wasn't valid and we couldn't proceed. # # Returns nothing. def call destroy_participatory_process_type! broadcast(:ok) end private attr_reader :current_user def destroy_participatory_process_type! transaction do Decidim.traceability.perform_action!( "delete", @participatory_process_type, current_user ) do @participatory_process_type.destroy! end end end end end end end
Version data entries
12 entries across 12 versions & 1 rubygems