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

This commit is contained in:
Rafael dos Santos Silva 2020-07-07 18:56:29 -03:00
parent 73a3e2ccbc
commit a4d5d1f51d

View File

@ -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))