Sha256: e9a5d28ca57db0535eaa6349b4449e25e324560a4613b3564e791db2f08a1ee5
Contents?: true
Size: 1.22 KB
Versions: 2
Compression:
Stored size: 1.22 KB
Contents
# frozen_string_literal: true module Decidim module Admin # This command deals with destroying a Feature from the admin panel. class DestroyFeature < Rectify::Command # Public: Initializes the command. # # feature - The Feature to be destroyed. # current_user - the user performing the action def initialize(feature, current_user) @feature = feature @current_user = current_user end # Public: Executes the command. # # Broadcasts :ok if it got destroyed, raises an exception otherwise. def call begin destroy_feature rescue StandardError return broadcast(:invalid) end broadcast(:ok) end private def destroy_feature transaction do run_before_hooks Decidim.traceability.perform_action!( "delete", @feature, @current_user ) do @feature.destroy! end run_hooks end end def run_before_hooks @feature.manifest.run_hooks(:before_destroy, @feature) end def run_hooks @feature.manifest.run_hooks(:destroy, @feature) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
decidim-admin-0.10.1 | app/commands/decidim/admin/destroy_feature.rb |
decidim-admin-0.10.0 | app/commands/decidim/admin/destroy_feature.rb |