FIX: Optimize a slow query when mentioning groups in chat messages (#24103)
This commit is contained in:
parent
2a75656ff2
commit
faac6773c5
|
@ -51,7 +51,8 @@ module Chat
|
||||||
end
|
end
|
||||||
|
|
||||||
def group_mentions
|
def group_mentions
|
||||||
chat_users.includes(:groups).joins(:groups).where(groups: mentionable_groups)
|
mentionable_groups_ids = mentionable_groups.pluck(:id)
|
||||||
|
chat_users.includes(:groups).joins(:groups).where("groups.id IN (?)", mentionable_groups_ids)
|
||||||
end
|
end
|
||||||
|
|
||||||
def here_mentions
|
def here_mentions
|
||||||
|
|
Loading…
Reference in New Issue