Class: Decidim::Admin::ProcessParticipatorySpacePrivateUserImportCsv

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

Instance Method Summary collapse

Constructor Details

#initialize(form, current_user, private_users_to) ⇒ ProcessParticipatorySpacePrivateUserImportCsv

Public: Initializes the command.

form - the form object containing the uploaded file current_user - the user performing the action private_users_to - The private_users_to that will hold the user role


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

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


25
26
27
28
29
30
# File 'decidim-admin/app/commands/decidim/admin/process_participatory_space_private_user_import_csv.rb', line 25

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

  process_csv
  broadcast(:ok)
end