FIX: Allow users already in automatic groups to log in (#18771)

This commit is contained in:
Natalie Tay 2022-10-27 14:59:27 +08:00 committed by GitHub
parent 101ec21bc9
commit 4b6a5f08fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -406,8 +406,12 @@ class DiscourseConnect < DiscourseConnectBase
def add_user_to_groups(user, groups)
groups.each do |group|
begin
GroupUser.create!(user_id: user.id, group_id: group.id)
GroupActionLogger.new(Discourse.system_user, group).log_add_user_to_group(user)
rescue Exception => e
Discourse.warn_exception(e, message: "User already in group")
end
end
end