emails: optimize /emails listing.
Fix a suboptimal query that made the /emails page really slow.
This commit is contained in:
@@ -12,7 +12,7 @@ class EmailAddress < ApplicationRecord
|
|||||||
|
|
||||||
def self.visible(user)
|
def self.visible(user)
|
||||||
if user.is_moderator?
|
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
|
else
|
||||||
none
|
none
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user