mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
fix: history sync missing contacts
This commit is contained in:
@@ -31,16 +31,13 @@ export const processHistoryMessage = (item: proto.IHistorySync, historyCache: Se
|
|||||||
for(const chat of item.conversations) {
|
for(const chat of item.conversations) {
|
||||||
const contactId = `c:${chat.id}`
|
const contactId = `c:${chat.id}`
|
||||||
if(chat.name && !historyCache.has(contactId)) {
|
if(chat.name && !historyCache.has(contactId)) {
|
||||||
contacts.push({
|
contacts.push({ id: chat.id, name: chat.name })
|
||||||
id: chat.id,
|
|
||||||
name: chat.name
|
|
||||||
})
|
|
||||||
historyCache.add(contactId)
|
historyCache.add(contactId)
|
||||||
}
|
}
|
||||||
|
|
||||||
for(const { message } of chat.messages || []) {
|
for(const { message } of chat.messages || []) {
|
||||||
const uqId = `${message?.key.remoteJid}:${message.key.id}`
|
const uqId = `${message.key.remoteJid}:${message.key.id}`
|
||||||
if(message && !historyCache.has(uqId)) {
|
if(!historyCache.has(uqId)) {
|
||||||
messages.push(message)
|
messages.push(message)
|
||||||
historyCache.add(uqId)
|
historyCache.add(uqId)
|
||||||
}
|
}
|
||||||
@@ -57,7 +54,7 @@ export const processHistoryMessage = (item: proto.IHistorySync, historyCache: Se
|
|||||||
case proto.HistorySync.HistorySyncHistorySyncType.PUSH_NAME:
|
case proto.HistorySync.HistorySyncHistorySyncType.PUSH_NAME:
|
||||||
for(const c of item.pushnames) {
|
for(const c of item.pushnames) {
|
||||||
const contactId = `c:${c.id}`
|
const contactId = `c:${c.id}`
|
||||||
if(historyCache.has(contactId)) {
|
if(!historyCache.has(contactId)) {
|
||||||
contacts.push({ notify: c.pushname, id: c.id })
|
contacts.push({ notify: c.pushname, id: c.id })
|
||||||
historyCache.add(contactId)
|
historyCache.add(contactId)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user