Sha256: 9712424de8d75216976273c94e595ee3c9def1d419ca58765975ad4c4d2b6fca

Contents?: true

Size: 1.07 KB

Versions: 46

Compression:

Stored size: 1.07 KB

Contents

# frozen_string_literal: true

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

        # Public: Unpublishes the RegistrationType.
        #
        # Broadcasts :ok if unpublished, :invalid otherwise.
        def call
          return broadcast(:invalid) if registration_type.nil? || !registration_type.published?

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

          broadcast(:ok)
        end

        private

        attr_reader :registration_type, :current_user
      end
    end
  end
end

Version data entries

46 entries across 46 versions & 1 rubygems

Version Path
decidim-conferences-0.26.10 app/commands/decidim/conferences/admin/unpublish_registration_type.rb
decidim-conferences-0.26.9 app/commands/decidim/conferences/admin/unpublish_registration_type.rb
decidim-conferences-0.26.8 app/commands/decidim/conferences/admin/unpublish_registration_type.rb
decidim-conferences-0.26.7 app/commands/decidim/conferences/admin/unpublish_registration_type.rb
decidim-conferences-0.26.5 app/commands/decidim/conferences/admin/unpublish_registration_type.rb
decidim-conferences-0.26.4 app/commands/decidim/conferences/admin/unpublish_registration_type.rb
decidim-conferences-0.26.3 app/commands/decidim/conferences/admin/unpublish_registration_type.rb
decidim-conferences-0.26.2 app/commands/decidim/conferences/admin/unpublish_registration_type.rb
decidim-conferences-0.26.1 app/commands/decidim/conferences/admin/unpublish_registration_type.rb
decidim-conferences-0.26.0 app/commands/decidim/conferences/admin/unpublish_registration_type.rb
decidim-conferences-0.26.0.rc2 app/commands/decidim/conferences/admin/unpublish_registration_type.rb
decidim-conferences-0.26.0.rc1 app/commands/decidim/conferences/admin/unpublish_registration_type.rb
decidim-conferences-0.25.2 app/commands/decidim/conferences/admin/unpublish_registration_type.rb
decidim-conferences-0.25.1 app/commands/decidim/conferences/admin/unpublish_registration_type.rb
decidim-conferences-0.25.0 app/commands/decidim/conferences/admin/unpublish_registration_type.rb
decidim-conferences-0.25.0.rc4 app/commands/decidim/conferences/admin/unpublish_registration_type.rb
decidim-conferences-0.25.0.rc3 app/commands/decidim/conferences/admin/unpublish_registration_type.rb
decidim-conferences-0.25.0.rc2 app/commands/decidim/conferences/admin/unpublish_registration_type.rb
decidim-conferences-0.25.0.rc1 app/commands/decidim/conferences/admin/unpublish_registration_type.rb
decidim-conferences-0.24.3 app/commands/decidim/conferences/admin/unpublish_registration_type.rb