fix: do not update chat + contact on prepend messages

This commit is contained in:
Adhiraj Singh
2022-01-07 13:55:26 +05:30
parent 6a2cb5a413
commit da65ae8f42

View File

@@ -498,7 +498,8 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
}
})
ev.on('messages.upsert', async({ messages }) => {
ev.on('messages.upsert', async({ messages, type }) => {
if(type === 'notify' || type === 'append') {
const chat: Partial<Chat> = { id: messages[0].key.remoteJid }
const contactNameUpdates: { [_: string]: string } = { }
for(const msg of messages) {
@@ -527,6 +528,7 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
id => ({ id, notify: contactNameUpdates[id] })
))
}
}
})
return { ...sock, processMessage, sendMessageAck }