mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 02:40:53 -06:00
FIX: only add user to invited groups once
This commit is contained in:
parent
cbe18eb0df
commit
9981257880
@ -88,8 +88,9 @@ InviteRedeemer = Struct.new(:invite, :username, :name) do
|
||||
end
|
||||
|
||||
def add_user_to_groups
|
||||
invite.groups.each do |g|
|
||||
invited_user.group_users.create(group_id: g.id)
|
||||
new_group_ids = invite.groups.pluck(:id) - invited_user.group_users.pluck(:group_id)
|
||||
new_group_ids.each do |id|
|
||||
invited_user.group_users.create(group_id: id)
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user