Sha256: 0bd799300ed3fbcc58a8299eaeecb528362f4c9b7fd665278cfa771b48f30a5c
Contents?: true
Size: 1.29 KB
Versions: 13
Compression:
Stored size: 1.29 KB
Contents
# frozen_string_literal: true module Decidim module Admin module ParticipatorySpace class DestroyAdmin < Decidim::Command # Public: Initializes the command. # # role - the UserRole to destroy # current_user - the user performing this action def initialize(role, current_user) @role = role @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 with_events do destroy_role! end broadcast(:ok) end private attr_reader :role, :current_user def event_arguments { class_name: role.class.name, role: role.id } end def destroy_role! extra_info = { resource: { title: role.user.name } } Decidim.traceability.perform_action!( "delete", role, current_user, extra_info ) do role.destroy! role end end end end end end
Version data entries
13 entries across 13 versions & 1 rubygems