mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 16:21:18 +08:00
PERF: PG queries for the UserEmail#email
column was not using the index.
This commit is contained in:
@ -104,7 +104,7 @@ class AdminUserIndexQuery
|
||||
def filter_by_user_with_bypass(filter)
|
||||
if filter =~ /.+@.+/
|
||||
# probably an email so try the bypass
|
||||
user_id = UserEmail.where(email: filter.downcase).pluck(:user_id).first
|
||||
user_id = UserEmail.where("lower(email) = ?", filter.downcase).pluck(:user_id).first
|
||||
if user_id
|
||||
return @query.where('users.id = ?', user_id)
|
||||
end
|
||||
|
Reference in New Issue
Block a user