mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 04:24:35 +08:00
FIX: N+1 query for avatars when searching for users
This commit is contained in:
@ -32,7 +32,7 @@ class Search
|
||||
|
||||
def self.from_user(u)
|
||||
SearchResult.new(type: :user, id: u.username_lower, title: u.username, url: "/users/#{u.username_lower}").tap do |r|
|
||||
r.avatar_template = User.avatar_template(u.email)
|
||||
r.avatar_template = u.avatar_template
|
||||
end
|
||||
end
|
||||
|
||||
@ -43,7 +43,7 @@ class Search
|
||||
def self.from_post(p)
|
||||
if p.post_number == 1
|
||||
# we want the topic link when it's the OP
|
||||
SearchResult.from_topic(p.topic)
|
||||
SearchResult.from_topic(p.topic)
|
||||
else
|
||||
SearchResult.new(type: :topic, id: p.topic.id, title: p.topic.title, url: p.url)
|
||||
end
|
||||
|
Reference in New Issue
Block a user