fix(whatsapp): prevent merged lid conversations from returning

This commit is contained in:
wmq
2026-08-03 01:35:44 +08:00
parent 9017c26f5b
commit 48d719e520
4 changed files with 59 additions and 5 deletions
+9
View File
@@ -13,6 +13,15 @@ export function canonicalWhatsAppJid(jid, identity = {}) {
return phone ? `${phone}@s.whatsapp.net` : raw
}
export function resolvedWhatsAppJid(jid, identity = {}, cachedJid = '') {
const fallback = canonicalWhatsAppJid(jid)
const resolved = canonicalWhatsAppJid(jid, identity)
if (resolved && resolved !== fallback) return resolved
const cached = canonicalWhatsAppJid(cachedJid)
return cached && cached !== fallback ? cached : fallback
}
export function whatsappCustomerStableId(jid) {
const normalized = canonicalWhatsAppJid(jid)
const hash = crypto.createHash('sha256').update(normalized).digest('hex').slice(0, 24)