PERF: Add user_id condition so we can use another index in the query

PERF: Add user_id condition so we can use another index in the query

diff --git a/app/models/user_summary.rb b/app/models/user_summary.rb
index 09c025b..a62e7d1 100644
--- a/app/models/user_summary.rb
+++ b/app/models/user_summary.rb
@@ -39,6 +39,7 @@ class UserSummary
   def links
     TopicLink
       .joins(:topic, :post)
+      .where(posts: { user_id: @user.id })
       .includes(:topic, :post)
       .where('posts.post_type IN (?)', Topic.visible_post_types(@guardian && @guardian.user))
       .merge(Topic.listable_topics.visible.secured(@guardian))

GitHub sha: a4d5d1f5

This commit appears in #10175 which was approved by eviltrout. It was merged by Falco.