FIX: don't show top links from private categories in user summary
This commit is contained in:
parent
4141cfc716
commit
e2928f78d2
|
@ -139,14 +139,12 @@ class Topic < ActiveRecord::Base
|
||||||
|
|
||||||
# Query conditions
|
# Query conditions
|
||||||
condition = if ids.present?
|
condition = if ids.present?
|
||||||
["NOT c.read_restricted or c.id in (:cats)", cats: ids]
|
["NOT read_restricted OR id IN (:cats)", cats: ids]
|
||||||
else
|
else
|
||||||
["NOT c.read_restricted"]
|
["NOT read_restricted"]
|
||||||
end
|
end
|
||||||
|
|
||||||
where("category_id IS NULL OR category_id IN (
|
where("topics.category_id IS NULL OR topics.category_id IN (SELECT id FROM categories WHERE #{condition[0]})", condition[1])
|
||||||
SELECT c.id FROM categories c
|
|
||||||
WHERE #{condition[0]})", condition[1])
|
|
||||||
}
|
}
|
||||||
|
|
||||||
attr_accessor :ignore_category_auto_close
|
attr_accessor :ignore_category_auto_close
|
||||||
|
|
|
@ -30,7 +30,6 @@ class UserSummary
|
||||||
.merge(Topic.listable_topics.visible.secured(@guardian))
|
.merge(Topic.listable_topics.visible.secured(@guardian))
|
||||||
.where(user: @user)
|
.where(user: @user)
|
||||||
.where('post_number > 1')
|
.where('post_number > 1')
|
||||||
.where('topics.archetype <> ?', Archetype.private_message)
|
|
||||||
.order('posts.like_count DESC, posts.created_at ASC')
|
.order('posts.like_count DESC, posts.created_at ASC')
|
||||||
.limit(MAX_SUMMARY_RESULTS)
|
.limit(MAX_SUMMARY_RESULTS)
|
||||||
end
|
end
|
||||||
|
@ -39,7 +38,8 @@ class UserSummary
|
||||||
TopicLink
|
TopicLink
|
||||||
.joins(:topic, :post)
|
.joins(:topic, :post)
|
||||||
.includes(:topic, :post)
|
.includes(:topic, :post)
|
||||||
.where('topics.archetype <> ?', Archetype.private_message)
|
.where('posts.post_type IN (?)', Topic.visible_post_types(@guardian && @guardian.user))
|
||||||
|
.merge(Topic.listable_topics.visible.secured(@guardian))
|
||||||
.where(user: @user)
|
.where(user: @user)
|
||||||
.where(internal: false, reflection: false, quote: false)
|
.where(internal: false, reflection: false, quote: false)
|
||||||
.order('clicks DESC, topic_links.created_at ASC')
|
.order('clicks DESC, topic_links.created_at ASC')
|
||||||
|
|
Loading…
Reference in New Issue