mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
User will enter email of users to invite to become booth responsible, which will create a user in User db with that email and a new booth request will be created.
21 lines
643 B
Ruby
21 lines
643 B
Ruby
module Invitation
|
|
extend ActiveSupport::Concern
|
|
|
|
def booth_responsible_invite
|
|
if booth_params[:invite_responsible]
|
|
emails_array = booth_params[:invite_responsible].split(',')
|
|
|
|
emails_array.each do |email|
|
|
new_user = User.find_by(email: email)
|
|
if new_user.nil?
|
|
User.invite!({ email: email }, current_user)
|
|
new_user = User.find_by(email: email)
|
|
end
|
|
if new_user && @booth.responsible_ids.exclude?(new_user.id)
|
|
BoothRequest.create(booth_id: @booth.id, user_id: new_user.id,
|
|
role: 'responsible')
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|