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.23.6 app/commands/decidim/accountability/admin/destroy_result.rb
decidim-accountability-0.24.2 app/commands/decidim/accountability/admin/destroy_result.rb
decidim-accountability-0.23.5 app/commands/decidim/accountability/admin/destroy_result.rb
decidim-accountability-0.24.1 app/commands/decidim/accountability/admin/destroy_result.rb
decidim-accountability-0.24.0 app/commands/decidim/accountability/admin/destroy_result.rb
decidim-accountability-0.24.0.rc2 app/commands/decidim/accountability/admin/destroy_result.rb
decidim-accountability-0.23.4 app/commands/decidim/accountability/admin/destroy_result.rb
decidim-accountability-0.24.0.rc1 app/commands/decidim/accountability/admin/destroy_result.rb
decidim-accountability-0.23.3 app/commands/decidim/accountability/admin/destroy_result.rb
decidim-accountability-0.23.2 app/commands/decidim/accountability/admin/destroy_result.rb
decidim-accountability-0.23.1 app/commands/decidim/accountability/admin/destroy_result.rb
decidim-accountability-0.23.1.rc1 app/commands/decidim/accountability/admin/destroy_result.rb
decidim-accountability-0.23.0 app/commands/decidim/accountability/admin/destroy_result.rb
decidim-accountability-0.22.0 app/commands/decidim/accountability/admin/destroy_result.rb
decidim-accountability-0.21.0 app/commands/decidim/accountability/admin/destroy_result.rb
decidim-accountability-0.20.1 app/commands/decidim/accountability/admin/destroy_result.rb
decidim-accountability-0.20.0 app/commands/decidim/accountability/admin/destroy_result.rb
decidim-accountability-0.19.1 app/commands/decidim/accountability/admin/destroy_result.rb
decidim-accountability-0.18.1 app/commands/decidim/accountability/admin/destroy_result.rb
decidim-accountability-0.19.0 app/commands/decidim/accountability/admin/destroy_result.rb