diff --git a/lib/topic_view.rb b/lib/topic_view.rb
index 8a2ea3b8e..27d898b4d 100644
--- a/lib/topic_view.rb
+++ b/lib/topic_view.rb
@@ -386,8 +386,8 @@ class TopicView
   def unfiltered_posts
     result = filter_post_types(@topic.posts)
     result = result.with_deleted if @guardian.can_see_deleted_posts?
-    result = @topic.posts.where("user_id IS NOT NULL") if @exclude_deleted_users
-    result = @topic.posts.where(hidden: false) if @exclude_hidden
+    result = result.where("user_id IS NOT NULL") if @exclude_deleted_users
+    result = result.where(hidden: false) if @exclude_hidden
     result
   end