FIX: only add user to invited groups once

This commit is contained in:
Sam 2015-02-26 14:05:44 +11:00
parent cbe18eb0df
commit 9981257880

View File

@ -88,8 +88,9 @@ InviteRedeemer = Struct.new(:invite, :username, :name) do
end end
def add_user_to_groups def add_user_to_groups
invite.groups.each do |g| new_group_ids = invite.groups.pluck(:id) - invited_user.group_users.pluck(:group_id)
invited_user.group_users.create(group_id: g.id) new_group_ids.each do |id|
invited_user.group_users.create(group_id: id)
end end
end end