mirror of
https://github.com/discourse/discourse.git
synced 2025-05-29 01:31:35 +08:00
FIX: Allow integer group_ids for create invite api (#21494)
This fixes a bug in the create invite API where if you passed in an integer for the group_ids field it would fail to add the user to the specified group.
This commit is contained in:
@ -579,6 +579,23 @@ RSpec.describe Group do
|
||||
expect(group.id).to eq Group[group.name.to_sym].id
|
||||
end
|
||||
|
||||
it "allows you to lookup a group by integer id" do
|
||||
group = Fabricate(:group)
|
||||
expect(group.id).to eq Group.lookup_groups(group_ids: group.id).first.id
|
||||
end
|
||||
|
||||
it "allows you to lookup groups by comma separated string" do
|
||||
group1 = Fabricate(:group)
|
||||
group2 = Fabricate(:group)
|
||||
expect([group1, group2]).to eq Group.lookup_groups(group_ids: "#{group1.id},#{group2.id}")
|
||||
end
|
||||
|
||||
it "allows you to lookup groups by array" do
|
||||
group1 = Fabricate(:group)
|
||||
group2 = Fabricate(:group)
|
||||
expect([group1, group2]).to eq Group.lookup_groups(group_ids: [group1.id, group2.id])
|
||||
end
|
||||
|
||||
it "can find desired groups correctly" do
|
||||
expect(Group.desired_trust_level_groups(2).sort).to eq [10, 11, 12]
|
||||
end
|
||||
|
Reference in New Issue
Block a user