Sha256: 31fa7e250fa6393caa3eb6c01c85da737094bf2a165d9e75c21c64754c53ae2d

Contents?: true

Size: 1.05 KB

Versions: 25

Compression:

Stored size: 1.05 KB

Contents

# frozen_string_literal: true

module Decidim
  module Conferences
    module Admin
      # This command gets called when a registration_type is published from the admin panel.
      class PublishRegistrationType < Decidim::Command
        # Public: Initializes the command.
        #
        # registration_type - The registration_type to publish.
        # current_user - the user performing the action
        def initialize(registration_type, current_user)
          @registration_type = registration_type
          @current_user = current_user
        end

        # Public: Publishes the Component.
        #
        # Broadcasts :ok if published, :invalid otherwise.
        def call
          return broadcast(:invalid) if registration_type.nil? || registration_type.published?

          Decidim.traceability.perform_action!(:publish, registration_type, current_user) do
            registration_type.publish!
          end

          broadcast(:ok)
        end

        private

        attr_reader :registration_type, :current_user
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
decidim-conferences-0.29.1 app/commands/decidim/conferences/admin/publish_registration_type.rb
decidim-conferences-0.28.4 app/commands/decidim/conferences/admin/publish_registration_type.rb
decidim-conferences-0.27.9 app/commands/decidim/conferences/admin/publish_registration_type.rb
decidim-conferences-0.29.0 app/commands/decidim/conferences/admin/publish_registration_type.rb
decidim-conferences-0.28.3 app/commands/decidim/conferences/admin/publish_registration_type.rb
decidim-conferences-0.27.8 app/commands/decidim/conferences/admin/publish_registration_type.rb
decidim-conferences-0.29.0.rc4 app/commands/decidim/conferences/admin/publish_registration_type.rb
decidim-conferences-0.29.0.rc3 app/commands/decidim/conferences/admin/publish_registration_type.rb
decidim-conferences-0.29.0.rc2 app/commands/decidim/conferences/admin/publish_registration_type.rb
decidim-conferences-0.29.0.rc1 app/commands/decidim/conferences/admin/publish_registration_type.rb
decidim-conferences-0.28.2 app/commands/decidim/conferences/admin/publish_registration_type.rb
decidim-conferences-0.27.7 app/commands/decidim/conferences/admin/publish_registration_type.rb
decidim-conferences-0.28.1 app/commands/decidim/conferences/admin/publish_registration_type.rb
decidim-conferences-0.27.6 app/commands/decidim/conferences/admin/publish_registration_type.rb
decidim-conferences-0.28.0 app/commands/decidim/conferences/admin/publish_registration_type.rb
decidim-conferences-0.27.5 app/commands/decidim/conferences/admin/publish_registration_type.rb
decidim-conferences-0.28.0.rc5 app/commands/decidim/conferences/admin/publish_registration_type.rb
decidim-conferences-0.28.0.rc4 app/commands/decidim/conferences/admin/publish_registration_type.rb
decidim-conferences-0.27.4 app/commands/decidim/conferences/admin/publish_registration_type.rb
decidim-conferences-0.27.3 app/commands/decidim/conferences/admin/publish_registration_type.rb