Sha256: 361d15c0ceaf6d00d45b13f6688c4f1c8a69bb5c95d6b14cd9abb1f9eb832f75
Contents?: true
Size: 1 KB
Versions: 25
Compression:
Stored size: 1 KB
Contents
# frozen_string_literal: true module Decidim module Votings module Admin # This command gets called when a voting is published from the admin panel. class PublishVoting < Rectify::Command # Public: Initializes the command. # # voting - The voting to publish. # current_user - the user performing the action def initialize(voting, current_user) @voting = voting @current_user = current_user end # Public: Publishes the Voting. # # Broadcasts :ok if published, :invalid otherwise. def call return broadcast(:invalid) if voting.nil? || voting.published? publish_voting broadcast(:ok, voting) end private attr_reader :voting, :current_user def publish_voting Decidim.traceability.perform_action!(:publish, voting, current_user, visibility: "all") do voting.publish! end end end end end end
Version data entries
25 entries across 25 versions & 1 rubygems