From 93262b38f4a519c754af7cc98795005d4d201611 Mon Sep 17 00:00:00 2001 From: Adhiraj Singh Date: Mon, 7 Mar 2022 18:17:43 +0530 Subject: [PATCH] fix: history sync missing contacts --- src/Utils/history.ts | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/Utils/history.ts b/src/Utils/history.ts index 1caf4d5..15c3d17 100644 --- a/src/Utils/history.ts +++ b/src/Utils/history.ts @@ -31,16 +31,13 @@ export const processHistoryMessage = (item: proto.IHistorySync, historyCache: Se for(const chat of item.conversations) { const contactId = `c:${chat.id}` if(chat.name && !historyCache.has(contactId)) { - contacts.push({ - id: chat.id, - name: chat.name - }) + contacts.push({ id: chat.id, name: chat.name }) historyCache.add(contactId) } for(const { message } of chat.messages || []) { - const uqId = `${message?.key.remoteJid}:${message.key.id}` - if(message && !historyCache.has(uqId)) { + const uqId = `${message.key.remoteJid}:${message.key.id}` + if(!historyCache.has(uqId)) { messages.push(message) historyCache.add(uqId) } @@ -57,7 +54,7 @@ export const processHistoryMessage = (item: proto.IHistorySync, historyCache: Se case proto.HistorySync.HistorySyncHistorySyncType.PUSH_NAME: for(const c of item.pushnames) { const contactId = `c:${c.id}` - if(historyCache.has(contactId)) { + if(!historyCache.has(contactId)) { contacts.push({ notify: c.pushname, id: c.id }) historyCache.add(contactId) }