Sha256: aae23135554df4aab44ed58407f6b7fa733b4f710a8c88012702aa2eb308fffa

Contents?: true

Size: 1.14 KB

Versions: 29

Compression:

Stored size: 1.14 KB

Contents

# frozen_string_literal: true

module Decidim
  module Initiatives
    module Admin
      # A command with all the business logic that sends an
      # existing initiative to technical validation.
      class SendInitiativeToTechnicalValidation < Rectify::Command
        # Public: Initializes the command.
        #
        # initiative - Decidim::Initiative
        # current_user - the user performing the action
        def initialize(initiative, current_user)
          @initiative = initiative
          @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
          @initiative = Decidim.traceability.perform_action!(
            :send_to_technical_validation,
            initiative,
            current_user
          ) do
            initiative.validating!
            initiative
          end
          broadcast(:ok, initiative)
        end

        private

        attr_reader :initiative, :current_user
      end
    end
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
decidim-initiatives-0.21.0 app/commands/decidim/initiatives/admin/send_initiative_to_technical_validation.rb
decidim-initiatives-0.20.1 app/commands/decidim/initiatives/admin/send_initiative_to_technical_validation.rb
decidim-initiatives-0.20.0 app/commands/decidim/initiatives/admin/send_initiative_to_technical_validation.rb
decidim-initiatives-0.19.1 app/commands/decidim/initiatives/admin/send_initiative_to_technical_validation.rb
decidim-initiatives-0.18.1 app/commands/decidim/initiatives/admin/send_initiative_to_technical_validation.rb
decidim-initiatives-0.19.0 app/commands/decidim/initiatives/admin/send_initiative_to_technical_validation.rb
decidim-initiatives-0.17.2 app/commands/decidim/initiatives/admin/send_initiative_to_technical_validation.rb
decidim-initiatives-0.18.0 app/commands/decidim/initiatives/admin/send_initiative_to_technical_validation.rb
decidim-initiatives-0.17.1 app/commands/decidim/initiatives/admin/send_initiative_to_technical_validation.rb
decidim-initiatives-0.16.1 app/commands/decidim/initiatives/admin/send_initiative_to_technical_validation.rb
decidim-initiatives-0.17.0 app/commands/decidim/initiatives/admin/send_initiative_to_technical_validation.rb
decidim-initiatives-0.16.0 app/commands/decidim/initiatives/admin/send_initiative_to_technical_validation.rb
decidim-initiatives-0.15.2 app/commands/decidim/initiatives/admin/send_initiative_to_technical_validation.rb
decidim-initiatives-0.15.1 app/commands/decidim/initiatives/admin/send_initiative_to_technical_validation.rb
decidim-initiatives-0.15.0 app/commands/decidim/initiatives/admin/send_initiative_to_technical_validation.rb
decidim-initiatives-0.14.4 app/commands/decidim/initiatives/admin/send_initiative_to_technical_validation.rb
decidim-initiatives-0.14.3 app/commands/decidim/initiatives/admin/send_initiative_to_technical_validation.rb
decidim-initiatives-0.14.2 app/commands/decidim/initiatives/admin/send_initiative_to_technical_validation.rb
decidim-initiatives-0.14.1 app/commands/decidim/initiatives/admin/send_initiative_to_technical_validation.rb
decidim-initiatives-0.13.1 app/commands/decidim/initiatives/admin/send_initiative_to_technical_validation.rb