Sha256: ba38d17d47f8dd76412711ead1f4ae47a5aae6fd0766dd8cedcc6844e53fc0c1
Contents?: true
Size: 1.05 KB
Versions: 9
Compression:
Stored size: 1.05 KB
Contents
# frozen_string_literal: true module Decidim module Conferences module Admin # A command that sets an conference as published. class PublishConference < Rectify::Command # Public: Initializes the command. # # conference - A Conference that will be published # current_user - the user performing the action def initialize(conference, current_user) @conference = conference @current_user = current_user end # Executes the command. Broadcasts these events: # # - :ok when everything is valid. # - :invalid if the data wasn't valid and we couldn't proceed. # # Returns nothing. def call return broadcast(:invalid) if conference.nil? || conference.published? Decidim.traceability.perform_action!("publish", conference, current_user) do conference.publish! end broadcast(:ok) end private attr_reader :conference, :current_user end end end end
Version data entries
9 entries across 9 versions & 1 rubygems