Sha256: b6aafcb2b8cfee344a328bfde5925cda308bc8ba5438ce3cc898aeaa0db648b0
Contents?: true
Size: 1.56 KB
Versions: 25
Compression:
Stored size: 1.56 KB
Contents
# frozen_string_literal: true module Decidim module Elections module Admin # This command gets called to start the key ceremony in the Bulletin Board. class StartKeyCeremony < Rectify::Command # Public: Initializes the command. # # form - An ActionForm object with the information needed to perform an action def initialize(form) @form = form end # Public: Starts the key ceremony for the Election. # # Broadcasts :ok if setup, :invalid otherwise. def call return broadcast(:invalid) if form.invalid? transaction do log_action start_key_ceremony end broadcast(:ok) rescue StandardError => e broadcast(:invalid, e.message) end private attr_accessor :form delegate :election, :bulletin_board, to: :form def log_action Decidim.traceability.perform_action!( :start_key_ceremony, election, form.current_user, visibility: "all" ) end def start_key_ceremony bulletin_board.start_key_ceremony(election.id) do |message_id| create_election_action(message_id) end end def create_election_action(message_id) Decidim::Elections::Action.create!( election: election, action: :start_key_ceremony, message_id: message_id, status: :pending ) end end end end end
Version data entries
25 entries across 25 versions & 1 rubygems