fix: WhatsApp group conversations showing raw JID as name#4
Conversation
Agent-Logs-Url: https://github.com/chz160/openmessage/sessions/5ce3edad-a20b-4601-8a37-c167966a2eba Co-authored-by: chz160 <3420276+chz160@users.noreply.github.com>
…strings.HasPrefix Agent-Logs-Url: https://github.com/chz160/openmessage/sessions/5ce3edad-a20b-4601-8a37-c167966a2eba Co-authored-by: chz160 <3420276+chz160@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR improves WhatsApp Native imports so group conversations that have no subject (and therefore surface a raw group JID like 16154856400-1585405251) get a more human-readable name in the web UI by deriving a name from group members.
Changes:
- Add a regex (
rawGroupJIDRe) to detect “raw” WhatsApp group JID-style names. - Add
deriveGroupName+isPhoneNumberto build readable group names from participant records. - Update
loadChatsto replace empty/raw group names with the derived participant-based name, with tests covering the new behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| internal/importer/whatsapp_native.go | Adds raw-JID detection and participant-derived naming logic for WhatsApp group chats. |
| internal/importer/whatsapp_native_test.go | Adds unit/integration-style tests for raw-JID detection, name derivation, and loadChats fallback behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@copilot apply changes based on the comments in this thread |
…d phone heuristic Agent-Logs-Url: https://github.com/chz160/openmessage/sessions/f3a6bd74-3849-43d3-9685-c22fc5f120ce Co-authored-by: chz160 <3420276+chz160@users.noreply.github.com>
Done in c8b7785. Three changes applied:
Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot apply changes based on the comments in this thread |
WhatsApp group chats without a subject set show a raw internal JID (e.g.
16154856400-1585405251) as the conversation name in the web UI instead of something readable.Changes
isRawGroupJIDName— replaces the previous regex approach; detects raw JID names by comparing the stored name directly against the known JID string or its local part (before@), avoiding false positives on real group subjects that happen to contain digits and hyphens (e.g. "2023-2024 Reunion")deriveGroupName— builds a human-readable name from group participant records, preferring saved display names over bare phone numbers; output is deduplicated, sorted alphabetically for a stable result across SQLite row orderings, and capped at 5 names with a "+N more" suffix for large groupsjoinGroupNames— helper that applies the N + "+N more" capping logicisPhoneNumber— tightened to require 7–15 digits (ITU-T E.164 range), preventing short numeric strings from being misclassified as phone numbersloadChatssecond pass — for groups whose name is empty or is a raw JID, derive from participants; fall back to the JID only when no participants exist