Sha256: b97348ee7cabc437b032c31ab46f9e500d7609ac9a70db6328d93a7ce7ea5022

Contents?: true

Size: 1.02 KB

Versions: 13

Compression:

Stored size: 1.02 KB

Contents

# frozen_string_literal: true

module Decidim
  module Conferences
    module Admin
      # A command that sets a Conference as published.
      class PublishConference < Decidim::Admin::ParticipatorySpace::Publish
        def call
          return broadcast(:invalid) if participatory_space.nil? || participatory_space.published?

          Decidim.traceability.perform_action!(:publish, participatory_space, user, **default_options) do
            participatory_space.publish!
          end

          send_notification
          broadcast(:ok, participatory_space)
        end

        private

        def send_notification
          return unless participatory_space.registrations_enabled?

          Decidim::EventsManager.publish(
            event: "decidim.events.conferences.registrations_enabled",
            event_class: Decidim::Conferences::ConferenceRegistrationsEnabledEvent,
            resource: participatory_space,
            followers: participatory_space.followers
          )
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
decidim-conferences-0.29.1 app/commands/decidim/conferences/admin/publish_conference.rb
decidim-conferences-0.28.4 app/commands/decidim/conferences/admin/publish_conference.rb
decidim-conferences-0.29.0 app/commands/decidim/conferences/admin/publish_conference.rb
decidim-conferences-0.28.3 app/commands/decidim/conferences/admin/publish_conference.rb
decidim-conferences-0.29.0.rc4 app/commands/decidim/conferences/admin/publish_conference.rb
decidim-conferences-0.29.0.rc3 app/commands/decidim/conferences/admin/publish_conference.rb
decidim-conferences-0.29.0.rc2 app/commands/decidim/conferences/admin/publish_conference.rb
decidim-conferences-0.29.0.rc1 app/commands/decidim/conferences/admin/publish_conference.rb
decidim-conferences-0.28.2 app/commands/decidim/conferences/admin/publish_conference.rb
decidim-conferences-0.28.1 app/commands/decidim/conferences/admin/publish_conference.rb
decidim-conferences-0.28.0 app/commands/decidim/conferences/admin/publish_conference.rb
decidim-conferences-0.28.0.rc5 app/commands/decidim/conferences/admin/publish_conference.rb
decidim-conferences-0.28.0.rc4 app/commands/decidim/conferences/admin/publish_conference.rb