Check targetTimestamp when looking for out-of-order reactions

This commit is contained in:
Ken Powers 2020-03-24 16:30:43 -04:00 committed by Scott Nonnenberg
parent cbc670e855
commit a20c7c3357
3 changed files with 21 additions and 12 deletions

View file

@ -31,7 +31,9 @@
const recid = ConversationController.getConversationId(
re.get('targetAuthorE164') || re.get('targetAuthorUuid')
);
return mcid === recid;
const mTime = message.get('sent_at');
const rTime = re.get('targetTimestamp');
return mcid === recid && mTime === rTime;
});
if (reactionsBySource.length > 0) {
@ -51,13 +53,15 @@
}
);
const targetMessage = messages.find(
m =>
m.get('source') === reaction.get('targetAuthorE164') ||
// Outgoing messages don't have a source and are extremely unlikely
// to have the same timestamp
m.isOutgoing()
);
const targetMessage = messages.find(m => {
const mcid = m.isOutgoing()
? ConversationController.getOurConversationId()
: m.get('conversationId');
const recid = ConversationController.getConversationId(
reaction.get('targetAuthorE164') || reaction.get('targetAuthorUuid')
);
return mcid === recid;
});
if (!targetMessage) {
window.log.info(