Sha256: c2d3bcd3ab17a8225200b1bbaac0624648e8dc53ba8ec3daa79038a983f920c1
Contents?: true
Size: 964 Bytes
Versions: 25
Compression:
Stored size: 964 Bytes
Contents
# frozen_string_literal: true module Decidim module Admin # This command gets called when a component is unpublished from the admin panel. class UnpublishComponent < Decidim::Command # Public: Initializes the command. # # component - The component to unpublish. # current_user - the user performing the action def initialize(component, current_user) @component = component @current_user = current_user end # Public: Unpublishes the Component. # # Broadcasts :ok if unpublished, :invalid otherwise. def call unpublish_component broadcast(:ok) end private attr_reader :component, :current_user def unpublish_component Decidim.traceability.perform_action!( :unpublish, component, current_user ) do component.unpublish! component end end end end end
Version data entries
25 entries across 25 versions & 1 rubygems