fix issue adding users to groups
This commit is contained in:
parent
b26057292e
commit
7571152d1d
|
@ -76,8 +76,8 @@ class Group < ActiveRecord::Base
|
||||||
GroupUser.where(group_id: trust_group_ids, user_id: user_id).delete_all
|
GroupUser.where(group_id: trust_group_ids, user_id: user_id).delete_all
|
||||||
|
|
||||||
if group = Group[name]
|
if group = Group[name]
|
||||||
group_users.build(user_id: user_id)
|
group.group_users.build(user_id: user_id)
|
||||||
group_users.save!
|
group.save!
|
||||||
else
|
else
|
||||||
refresh_automatic_group!(name)
|
refresh_automatic_group!(name)
|
||||||
end
|
end
|
||||||
|
|
|
@ -47,6 +47,11 @@ describe Group do
|
||||||
|
|
||||||
Group[:trust_level_1].user_ids.should == []
|
Group[:trust_level_1].user_ids.should == []
|
||||||
Group[:trust_level_2].user_ids.should == [user.id]
|
Group[:trust_level_2].user_ids.should == [user.id]
|
||||||
|
|
||||||
|
user2 = Fabricate(:coding_horror)
|
||||||
|
user2.change_trust_level!(:regular)
|
||||||
|
|
||||||
|
Group[:trust_level_2].user_ids.sort.should == [user.id, user2.id].sort
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue