Sha256: 25d4804225530928605a2c4388f9f6832c00ddcf893ed9b1eea56acc26b7d2cc
Contents?: true
Size: 1.15 KB
Versions: 13
Compression:
Stored size: 1.15 KB
Contents
# frozen_string_literal: true module Decidim module Meetings module Admin # A command with all the business logic that unpublishes an # existing meeting. class UnpublishMeeting < Decidim::Command # Public: Initializes the command. # # meeting - Decidim::Meetings::Meeting # current_user - the user performing the action def initialize(meeting, current_user) @meeting = meeting @current_user = current_user end # Executes the command. Broadcasts these events: # # - :ok when everything is valid. # - :invalid if the form was not valid and we could not proceed. # # Returns nothing. def call return broadcast(:invalid) unless meeting.published? @meeting = Decidim.traceability.perform_action!( :unpublish, meeting, current_user, visibility: "all" ) do meeting.unpublish! meeting end broadcast(:ok, meeting) end private attr_reader :meeting, :current_user end end end end
Version data entries
13 entries across 13 versions & 1 rubygems