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.12.2 app/commands/decidim/initiatives/admin/send_initiative_to_technical_validation.rb
decidim-initiatives-0.13.0 app/commands/decidim/initiatives/admin/send_initiative_to_technical_validation.rb
decidim-initiatives-0.12.1 app/commands/decidim/initiatives/admin/send_initiative_to_technical_validation.rb
decidim-initiatives-0.13.0.pre1 app/commands/decidim/initiatives/admin/send_initiative_to_technical_validation.rb
decidim-initiatives-0.12.0 app/commands/decidim/initiatives/admin/send_initiative_to_technical_validation.rb
decidim-initiatives-0.11.2 app/commands/decidim/initiatives/admin/send_initiative_to_technical_validation.rb
decidim-initiatives-0.12.0.pre app/commands/decidim/initiatives/admin/send_initiative_to_technical_validation.rb
decidim-initiatives-0.11.1 app/commands/decidim/initiatives/admin/send_initiative_to_technical_validation.rb
decidim-initiatives-0.11.0.pre1 app/commands/decidim/initiatives/admin/send_initiative_to_technical_validation.rb