fix: account for 0 messages in stanza

This commit is contained in:
Adhiraj Singh
2021-11-21 16:52:59 +05:30
parent 1cd96ad039
commit 27cf3954e8

View File

@@ -425,13 +425,17 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
}) })
} }
ev.emit( if(fullMessages.length) {
'messages.upsert', ev.emit(
{ 'messages.upsert',
messages: fullMessages.map(m => proto.WebMessageInfo.fromObject(m)), {
type: stanza.attrs.offline ? 'append' : 'notify' messages: fullMessages.map(m => proto.WebMessageInfo.fromObject(m)),
} type: stanza.attrs.offline ? 'append' : 'notify'
) }
)
} else {
logger.warn({ stanza }, `received node with 0 messages`)
}
}) })
ws.on('CB:ack,class:message', async(node: BinaryNode) => { ws.on('CB:ack,class:message', async(node: BinaryNode) => {