fix: receipt not being sent on empty message

This commit is contained in:
Adhiraj Singh
2021-11-25 15:41:34 +05:30
parent 841a129019
commit 1f8663092f

View File

@@ -357,6 +357,11 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
messageTimestamp: dec.timestamp,
pushName: dec.pushname
}
if(!dec.failures.length) {
await sendMessageAck(stanza, { class: 'receipt' })
}
// if there were some successful decryptions
if(dec.successes.length) {
// send message receipt
@@ -388,8 +393,6 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
await sendNode({ tag: 'receipt', attrs: recpAttrs })
logger.debug({ msgId: dec.msgId }, 'sent message receipt')
await sendMessageAck(stanza, { class: 'receipt' })
await sendDeliveryReceipt(dec.chatId, dec.participant, [dec.msgId])
logger.debug({ msgId: dec.msgId }, 'sent delivery receipt')
}