FIX: properly filter whispers in user stream

This commit is contained in:
Régis Hanol
2015-09-22 00:50:52 +02:00
parent 2ae032c9b0
commit 4f7140fb32
7 changed files with 18 additions and 17 deletions
+3 -1
View File
@@ -305,7 +305,6 @@ SQL
end
def self.apply_common_filters(builder,user_id,guardian,ignore_private_messages=false)
# We never return deleted topics in activity
builder.where("t.deleted_at is null")
@@ -318,6 +317,9 @@ SQL
builder.where("NOT COALESCE(p.hidden, false) OR p.user_id = :current_user_id", current_user_id: current_user_id )
end
visible_post_types = Topic.visible_post_types(guardian.user)
builder.where("COALESCE(p.post_type, p2.post_type) IN (:visible_post_types)", visible_post_types: visible_post_types)
unless (guardian.user && guardian.user.id == user_id) || guardian.is_staff?
builder.where("a.action_type not in (#{BOOKMARK})")
builder.where("t.visible")