mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
fix: Fixed In Memory Store: contacts.upsert handle (#144)
This commit is contained in:
@@ -146,11 +146,13 @@ export default (
|
||||
logger.debug({ chatsAdded }, 'synced chats')
|
||||
|
||||
const oldContacts = contactsUpsert(newContacts)
|
||||
for(const jid of oldContacts) {
|
||||
delete contacts[jid]
|
||||
if(isLatest) {
|
||||
for(const jid of oldContacts) {
|
||||
delete contacts[jid]
|
||||
}
|
||||
}
|
||||
|
||||
logger.debug({ deletedContacts: oldContacts.size, newContacts }, 'synced contacts')
|
||||
logger.debug({ deletedContacts: isLatest ? oldContacts.size : 0, newContacts }, 'synced contacts')
|
||||
|
||||
for(const msg of newMessages) {
|
||||
const jid = msg.key.remoteJid!
|
||||
@@ -161,6 +163,10 @@ export default (
|
||||
logger.debug({ messages: newMessages.length }, 'synced messages')
|
||||
})
|
||||
|
||||
ev.on('contacts.upsert', contacts => {
|
||||
contactsUpsert(contacts)
|
||||
})
|
||||
|
||||
ev.on('contacts.update', updates => {
|
||||
for(const update of updates) {
|
||||
if(contacts[update.id!]) {
|
||||
|
||||
Reference in New Issue
Block a user