mirror of
https://github.com/discourse/discourse.git
synced 2025-06-06 02:54:41 +08:00
FIX: Don't attempt to add user again to a group when syncing groups via SSO (#18772)
This commit fixes a regression introduced in 8979adc where under certain conditions the groups syncing logic in Discourse Connect would try to add users to groups they're already members of and cause errors when users try to sign in using Discourse Connect.
This commit is contained in:
@ -206,7 +206,7 @@ RSpec.describe DiscourseConnect do
|
||||
expect(group2.usernames).to eq("")
|
||||
|
||||
group1.add(user)
|
||||
group1.save
|
||||
group1.save!
|
||||
|
||||
sso.lookup_or_create_user(ip_address)
|
||||
expect(group1.usernames).to eq("")
|
||||
@ -216,6 +216,16 @@ RSpec.describe DiscourseConnect do
|
||||
sso.lookup_or_create_user(ip_address)
|
||||
expect(group1.usernames).to eq("")
|
||||
expect(group2.usernames).to eq("")
|
||||
|
||||
group1.add(user)
|
||||
group1.save!
|
||||
group2.add(user)
|
||||
group2.save!
|
||||
sso.groups = "#{group1.name},badname,trust_level_4"
|
||||
|
||||
sso.lookup_or_create_user(ip_address)
|
||||
expect(group1.usernames).to eq(user.username)
|
||||
expect(group2.usernames).to eq("")
|
||||
end
|
||||
|
||||
it "can specify groups" do
|
||||
|
Reference in New Issue
Block a user