Sha256: 8dd9ab971a04665b301a1cf38755a032d343429e3971785afdd078c1baebd5a9

Contents?: true

Size: 1016 Bytes

Versions: 63

Compression:

Stored size: 1016 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Accountability
    module Admin
      # This command is executed when the user destroys a Result from the admin
      # panel.
      class DestroyResult < Rectify::Command
        # Initializes an UpdateResult Command.
        #
        # result - The current instance of the result to be destroyed.
        # current_user - the user performing the action
        def initialize(result, current_user)
          @result = result
          @current_user = current_user
        end

        # Destroys the result.
        #
        # Broadcasts :ok if successful, :invalid otherwise.
        def call
          destroy_result

          broadcast(:ok)
        end

        private

        attr_reader :result, :current_user

        def destroy_result
          Decidim.traceability.perform_action!(
            :delete,
            result,
            current_user
          ) do
            result.destroy!
          end
        end
      end
    end
  end
end

Version data entries

63 entries across 63 versions & 1 rubygems

Version Path
decidim-accountability-0.17.2 app/commands/decidim/accountability/admin/destroy_result.rb
decidim-accountability-0.18.0 app/commands/decidim/accountability/admin/destroy_result.rb
decidim-accountability-0.17.1 app/commands/decidim/accountability/admin/destroy_result.rb
decidim-accountability-0.16.1 app/commands/decidim/accountability/admin/destroy_result.rb
decidim-accountability-0.17.0 app/commands/decidim/accountability/admin/destroy_result.rb
decidim-accountability-0.16.0 app/commands/decidim/accountability/admin/destroy_result.rb
decidim-accountability-0.15.2 app/commands/decidim/accountability/admin/destroy_result.rb
decidim-accountability-0.15.1 app/commands/decidim/accountability/admin/destroy_result.rb
decidim-accountability-0.15.0 app/commands/decidim/accountability/admin/destroy_result.rb
decidim-accountability-0.14.4 app/commands/decidim/accountability/admin/destroy_result.rb
decidim-accountability-0.14.3 app/commands/decidim/accountability/admin/destroy_result.rb
decidim-accountability-0.14.2 app/commands/decidim/accountability/admin/destroy_result.rb
decidim-accountability-0.14.1 app/commands/decidim/accountability/admin/destroy_result.rb
decidim-accountability-0.13.1 app/commands/decidim/accountability/admin/destroy_result.rb
decidim-accountability-0.12.2 app/commands/decidim/accountability/admin/destroy_result.rb
decidim-accountability-0.13.0 app/commands/decidim/accountability/admin/destroy_result.rb
decidim-accountability-0.12.1 app/commands/decidim/accountability/admin/destroy_result.rb
decidim-accountability-0.13.0.pre1 app/commands/decidim/accountability/admin/destroy_result.rb
decidim-accountability-0.12.0 app/commands/decidim/accountability/admin/destroy_result.rb
decidim-accountability-0.11.2 app/commands/decidim/accountability/admin/destroy_result.rb