mirror of
https://github.com/dartdavros/chatballs.git
synced 2026-10-06 17:44:59 +03:00
fix(conversations): prefetch support_identity_snapshot
conversation_payload для support-диалогов дёргает support_identity_snapshot FK на каждую строку списка inbox → N+1. Добавлен select_related в conversations_for_organization. Для sales (snapshot=null) безвредно.
This commit is contained in:
1 parent
94e2d1a19c
commit
fbf4919bee
1 file changed
+8
-1
@@ -6,7 +6,14 @@ from hub_platform.conversations.models import Conversation
|
||||
def conversations_for_organization(organization_id: int) -> QuerySet[Conversation]:
|
||||
return (
|
||||
Conversation.objects.filter(organization_id=organization_id)
|
||||
.select_related("channel", "channel__product", "contact", "connection", "assigned_operator")
|
||||
.select_related(
|
||||
"channel",
|
||||
"channel__product",
|
||||
"contact",
|
||||
"connection",
|
||||
"assigned_operator",
|
||||
"support_identity_snapshot",
|
||||
)
|
||||
.order_by("-last_activity_at")
|
||||
)
|
||||
|
||||
|
||||
Reference in new issue
Block a user