Skip to content

A tiny friend in your Mac's notch and on your iPhone that keeps an eye on your AI coding agents: Claude Code, Codex, Cursor, Gemini CLI, Antigravity and more. Approve from the notch or your Lock Screen.

fix(windows): WhatsApp groups show their names instead of "Group <id>"

ARNAV AGGARWAL54da214caa76
diff --git a/windows/src-tauri/src/whatsapp/model.rs b/windows/src-tauri/src/whatsapp/model.rs
index 19921676..5aa7bc83 100644
--- a/windows/src-tauri/src/whatsapp/model.rs
+++ b/windows/src-tauri/src/whatsapp/model.rs
@@ -110,6 +110,14 @@ pub fn display_number(jid: &str) -> String {
}
}
+/// A chat's name that names nothing: empty, only its number, or GOWA's stand-in for a group it
+/// hasn't named yet ("Group 120363…").
+pub fn unnamed(jid: &str, name: &str) -> bool {
+ let name = name.trim();
+ let id = user_part(jid);
+ name.is_empty() || name == display_number(jid) || name == id || name.strip_prefix("Group ") == Some(id)
+}
+
/// The same person under its several forms: "33612345678:[email protected]" and
/// "[email protected]" are one chat.
pub fn normalized(jid: &str) -> String {
@@ -200,7 +208,7 @@ impl Inbox {
} else {
Some(message.sender_name.clone())
};
- let given = name.map(str::to_string).or_else(|| message.chat_name.clone()).filter(|n| !n.is_empty());
+ let given = name.map(str::to_string).or_else(|| message.chat_name.clone()).filter(|n| !unnamed(&chat, n));
let mut conversation = self.conversations.remove(&chat).unwrap_or_else(|| Conversation {
id: chat.clone(),
name: given.clone().or_else(|| person_name.clone()).unwrap_or_else(|| number.clone()),
@@ -515,6 +523,10 @@ mod tests {
assert!(!text_mentions("hey @33612345678", None));
assert_eq!(display_number("33612345678:[email protected]"), "+33612345678");
assert_eq!(display_number("abc@lid"), "abc");
+ assert!(unnamed("[email protected]", "+120363401"));
+ assert!(unnamed("[email protected]", "Group 120363401"));
+ assert!(!unnamed("[email protected]", "Group chat"));
+ assert!(!unnamed("[email protected]", "Famille"));
assert_eq!(normalized("33612345678:[email protected]"), "[email protected]");
assert_eq!(normalized("nojid"), "nojid");
}