mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
fix: In memory store: normalize user when asserting message list to update messages (#49)
* normalize user when asserting message list to update messages * in memory * update verifies status * code style improved
This commit is contained in:
@@ -167,7 +167,16 @@ export default (
|
|||||||
})
|
})
|
||||||
ev.on('messages.update', updates => {
|
ev.on('messages.update', updates => {
|
||||||
for(const { update, key } of updates) {
|
for(const { update, key } of updates) {
|
||||||
const list = assertMessageList(key.remoteJid!)
|
const list = assertMessageList(jidNormalizedUser(key.remoteJid!))
|
||||||
|
if(update?.status) {
|
||||||
|
const listStatus = list.get(key.id!)?.status
|
||||||
|
if(listStatus && update?.status <= listStatus) {
|
||||||
|
logger.debug({ update, storedStatus: listStatus }, 'status stored newer then update')
|
||||||
|
delete update.status
|
||||||
|
logger.debug({ update }, 'new update object')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const result = list.updateAssign(key.id!, update)
|
const result = list.updateAssign(key.id!, update)
|
||||||
if(!result) {
|
if(!result) {
|
||||||
logger.debug({ update }, 'got update for non-existent message')
|
logger.debug({ update }, 'got update for non-existent message')
|
||||||
|
|||||||
Reference in New Issue
Block a user