Allow linking chats

This commit is contained in:
2026-02-19 17:13:34 +00:00
parent bac2841298
commit 0816687c71
15 changed files with 369 additions and 461 deletions

View File

@@ -38,6 +38,7 @@ from core.models import (
PatternMitigationPlan,
Person,
PersonIdentifier,
PlatformChatLink,
WorkspaceConversation,
)
from core.realtime.typing_state import get_person_typing_state
@@ -1469,11 +1470,31 @@ def _context_base(user, service, identifier, person):
identifier = person_identifier.identifier
person = person_identifier.person
if person_identifier is None and identifier:
bare_id = identifier.split("@", 1)[0].strip()
group_link = PlatformChatLink.objects.filter(
user=user,
service=service,
chat_identifier=bare_id,
is_group=True,
).first()
if group_link:
return {
"person_identifier": None,
"service": service,
"identifier": f"{bare_id}@g.us",
"person": None,
"is_group": True,
"group_name": group_link.chat_name or bare_id,
}
return {
"person_identifier": person_identifier,
"service": service,
"identifier": identifier,
"person": person,
"is_group": False,
"group_name": "",
}
@@ -2095,6 +2116,8 @@ def _panel_context(
"typing_state_json": json.dumps(typing_state),
"platform_options": platform_options,
"recent_contacts": recent_contacts,
"is_group": base.get("is_group", False),
"group_name": base.get("group_name", ""),
}