Class: Decidim::ParticipatoryProcesses::Admin::DestroyParticipatoryProcessAdmin

Inherits:
Rectify::Command
  • Object
show all
Defined in:
decidim-participatory_processes/app/commands/decidim/participatory_processes/admin/destroy_participatory_process_admin.rb

Overview

A command with all the business logic when destroying a participatory process admin in the system.

Instance Method Summary collapse

Constructor Details

#initialize(role, current_user) ⇒ DestroyParticipatoryProcessAdmin

Public: Initializes the command.

role - the ParticipatoryProcessUserRole to destroy current_user - the user performing this action


13
14
15
16
# File 'decidim-participatory_processes/app/commands/decidim/participatory_processes/admin/destroy_participatory_process_admin.rb', line 13

def initialize(role, current_user)
  @role = role
  @current_user = current_user
end

Instance Method Details

#callObject

Executes the command. Broadcasts these events:

  • :ok when everything is valid.

  • :invalid if the form wasn't valid and we couldn't proceed.

Returns nothing.


24
25
26
27
# File 'decidim-participatory_processes/app/commands/decidim/participatory_processes/admin/destroy_participatory_process_admin.rb', line 24

def call
  destroy_role!
  broadcast(:ok)
end