Class: Decidim::Conferences::Admin::PublishConference
- Inherits:
-
Decidim::Command
- Object
- Decidim::Command
- Decidim::Conferences::Admin::PublishConference
- Defined in:
- decidim-conferences/app/commands/decidim/conferences/admin/publish_conference.rb
Overview
A command that sets an conference as published.
Instance Method Summary collapse
-
#call ⇒ Object
Executes the command.
-
#initialize(conference, current_user) ⇒ PublishConference
constructor
Public: Initializes the command.
Constructor Details
#initialize(conference, current_user) ⇒ PublishConference
Public: Initializes the command.
conference - A Conference that will be published current_user - the user performing the action
12 13 14 15 |
# File 'decidim-conferences/app/commands/decidim/conferences/admin/publish_conference.rb', line 12 def initialize(conference, current_user) @conference = conference @current_user = current_user end |
Instance Method Details
#call ⇒ Object
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.
23 24 25 26 27 28 29 30 31 32 |
# File 'decidim-conferences/app/commands/decidim/conferences/admin/publish_conference.rb', line 23 def call return broadcast(:invalid) if conference.nil? || conference.published? Decidim.traceability.perform_action!("publish", conference, current_user) do conference.publish! end broadcast(:ok) send_notification end |