Sha256: 8bdc6d3330c7a8af94555d6cbe7c84640bd9d3f82a610121030e032ed94a16a5
Contents?: true
Size: 873 Bytes
Versions: 4
Compression:
Stored size: 873 Bytes
Contents
# frozen_string_literal: true module Decidim module Admin # A command that sets a participatory process as published. class PublishParticipatoryProcess < Rectify::Command # Public: Initializes the command. # # process - A ParticipatoryProcess that will be published def initialize(process) @process = process end # Executes the command. Braodcasts 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 process.nil? || process.published? publish_process broadcast(:ok) end private attr_reader :process def publish_process process.update_attribute(:published_at, Time.current) end end end end
Version data entries
4 entries across 4 versions & 2 rubygems