mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
PERF: improve perf of initial payload
also reduce querying in topic query
This commit is contained in:
@@ -46,6 +46,7 @@ class TopicQuery
|
||||
options.assert_valid_keys(VALID_OPTIONS)
|
||||
@options = options.dup
|
||||
@user = user
|
||||
@guardian = Guardian.new(@user)
|
||||
end
|
||||
|
||||
def joined_topic_user(list=nil)
|
||||
@@ -359,7 +360,7 @@ class TopicQuery
|
||||
when 'unlisted'
|
||||
result = result.where('NOT topics.visible')
|
||||
when 'deleted'
|
||||
guardian = Guardian.new(@user)
|
||||
guardian = @guardian
|
||||
if guardian.is_staff?
|
||||
result = result.where('topics.deleted_at IS NOT NULL')
|
||||
require_deleted_clause = false
|
||||
@@ -391,7 +392,7 @@ class TopicQuery
|
||||
result = result.where('topics.posts_count <= ?', options[:max_posts]) if options[:max_posts].present?
|
||||
result = result.where('topics.posts_count >= ?', options[:min_posts]) if options[:min_posts].present?
|
||||
|
||||
Guardian.new(@user).filter_allowed_categories(result)
|
||||
@guardian.filter_allowed_categories(result)
|
||||
end
|
||||
|
||||
def remove_muted_categories(list, user, opts=nil)
|
||||
|
||||
Reference in New Issue
Block a user