mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 04:24:35 +08:00
PERF: cache category topic ids
This commit is contained in:
@ -699,7 +699,7 @@ class TopicQuery
|
||||
|
||||
def random_suggested(topic, count, excluded_topic_ids=[])
|
||||
result = default_results(unordered: true, per_page: count).where(closed: false, archived: false)
|
||||
excluded_topic_ids += Category.pluck(:topic_id).compact
|
||||
excluded_topic_ids += Category.topic_ids.to_a
|
||||
result = result.where("topics.id NOT IN (?)", excluded_topic_ids) unless excluded_topic_ids.empty?
|
||||
|
||||
result = remove_muted_categories(result, @user)
|
||||
|
Reference in New Issue
Block a user