emails: optimize /emails listing.

Fix a suboptimal query that made the /emails page really slow.
This commit is contained in:
evazion
2020-12-21 22:42:50 -06:00
parent f3880569e1
commit 0be9c8dc8b
+1 -1
View File
@@ -12,7 +12,7 @@ class EmailAddress < ApplicationRecord
def self.visible(user)
if user.is_moderator?
where(user: User.where("level < ?", user.level)).or(where(user: user))
where(user: User.where("level < ?", user.level).or(User.where(id: user.id)))
else
none
end