mirror of
https://github.com/discourse/discourse.git
synced 2025-01-18 14:42:46 +08:00
Remove another N+1 query from categories page
This commit is contained in:
parent
0b1550f9d4
commit
fa4bc90fbb
|
@ -40,6 +40,7 @@ class CategoryList
|
|||
@topics_by_id = {}
|
||||
|
||||
@all_topics = Topic.where(id: category_featured_topics.map(&:topic_id))
|
||||
@all_topics = @all_topics.includes(:last_poster) if include_latest_posts?
|
||||
@all_topics.each do |t|
|
||||
t.include_last_poster = true if include_latest_posts? # hint for serialization
|
||||
@topics_by_id[t.id] = t
|
||||
|
|
Loading…
Reference in New Issue
Block a user