mirror of
https://github.com/discourse/discourse.git
synced 2025-03-26 22:36:08 +08:00
PERF: Add user_id condition so we can use another index in the query
This commit is contained in:
parent
73a3e2ccbc
commit
a4d5d1f51d
@ -39,6 +39,7 @@ class UserSummary
|
|||||||
def links
|
def links
|
||||||
TopicLink
|
TopicLink
|
||||||
.joins(:topic, :post)
|
.joins(:topic, :post)
|
||||||
|
.where(posts: { user_id: @user.id })
|
||||||
.includes(:topic, :post)
|
.includes(:topic, :post)
|
||||||
.where('posts.post_type IN (?)', Topic.visible_post_types(@guardian && @guardian.user))
|
.where('posts.post_type IN (?)', Topic.visible_post_types(@guardian && @guardian.user))
|
||||||
.merge(Topic.listable_topics.visible.secured(@guardian))
|
.merge(Topic.listable_topics.visible.secured(@guardian))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user