Class: Decidim::Admin::ProcessUserGroupVerificationCsv

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

Overview

A command with all the business logic when processing the CSV to verify user groups.

Instance Method Summary collapse

Constructor Details

#initialize(form) ⇒ ProcessUserGroupVerificationCsv

Public: Initializes the command.

form - the form object containing the uploaded file



13
14
15
# File 'app/commands/decidim/admin/process_user_group_verification_csv.rb', line 13

def initialize(form)
  @form = form
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.



23
24
25
26
27
28
# File 'app/commands/decidim/admin/process_user_group_verification_csv.rb', line 23

def call
  return broadcast(:invalid) unless @form.valid?

  process_csv
  broadcast(:ok)
end