Class: Decidim::Admin::ParticipatorySpace::ImportMemberCsvJob

Inherits:
ApplicationJob
  • Object
show all
Defined in:
app/jobs/decidim/admin/participatory_space/import_member_csv_job.rb

Overview

Custom ApplicationJob scoped to the admin panel.

Instance Method Summary collapse

Instance Method Details

#perform(email, user_name, participatory_space, current_user) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'app/jobs/decidim/admin/participatory_space/import_member_csv_job.rb', line 11

def perform(email, user_name, participatory_space, current_user)
  return if email.blank? || user_name.blank?

  params = {
    name: user_name,
    email: email.downcase.strip
  }
  member_form = MemberForm.from_params(params, participatory_space:)
                          .with_context(
                            current_user:,
                            current_participatory_space: participatory_space
                          )

  CreateMember.call(member_form, participatory_space, via_csv: true)
end