fix: only send receipt if participant present

This commit is contained in:
Adhiraj Singh
2022-06-22 14:58:26 +05:30
parent 33fffc4aad
commit a75d9118bd

View File

@@ -383,17 +383,19 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
) )
) { ) {
if(isJidGroup(remoteJid)) { if(isJidGroup(remoteJid)) {
const updateKey: keyof MessageUserReceipt = status === proto.WebMessageInfo.WebMessageInfoStatus.DELIVERY_ACK ? 'receiptTimestamp' : 'readTimestamp' if(attrs.participant) {
ev.emit( const updateKey: keyof MessageUserReceipt = status === proto.WebMessageInfo.WebMessageInfoStatus.DELIVERY_ACK ? 'receiptTimestamp' : 'readTimestamp'
'message-receipt.update', ev.emit(
ids.map(id => ({ 'message-receipt.update',
key: { ...key, id }, ids.map(id => ({
receipt: { key: { ...key, id },
userJid: jidNormalizedUser(attrs.participant), receipt: {
[updateKey]: +attrs.t userJid: jidNormalizedUser(attrs.participant),
} [updateKey]: +attrs.t
})) }
) }))
)
}
} else { } else {
ev.emit( ev.emit(
'messages.update', 'messages.update',