PERF: Remove N+1 query when saving a user.
This commit is contained in:
parent
0988420b48
commit
ec73224b5e
|
@ -941,7 +941,7 @@ class User < ActiveRecord::Base
|
||||||
|
|
||||||
domains = group.automatic_membership_email_domains.gsub('.', '\.')
|
domains = group.automatic_membership_email_domains.gsub('.', '\.')
|
||||||
|
|
||||||
if user.reload.email =~ Regexp.new("@(#{domains})$", true) && !group.users.include?(user)
|
if user.email =~ Regexp.new("@(#{domains})$", true) && !group.users.include?(user)
|
||||||
group.add(user)
|
group.add(user)
|
||||||
GroupActionLogger.new(Discourse.system_user, group).log_add_user_to_group(user)
|
GroupActionLogger.new(Discourse.system_user, group).log_add_user_to_group(user)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue