fix(whatsapp): prevent merged lid conversations from returning
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user