Class: Decidim::ActionDelegator::Admin::InviteParticipantsJob

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

Instance Method Summary collapse

Instance Method Details

#perform(current_setting, organization) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'app/jobs/decidim/action_delegator/admin/invite_participants_job.rb', line 9

def perform(current_setting, organization)
  @current_setting = current_setting
  @organization = organization

  users_list_to_invite.find_each do |participant|
    form = InvitationParticipantForm.new(
      name: participant.email.split("@").first&.gsub(/\W/, ""),
      email: participant.email.downcase,
      organization: organization,
      admin: false
    )

    Decidim::InviteUser.call(form)
  end
end