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

@ -181,6 +181,11 @@
return null;
},
getOurConversationId() {
const e164 = textsecure.storage.user.getNumber();
const uuid = textsecure.storage.user.getUuid();
return this.getConversationId(e164 || uuid);
},
prepareForSend(id, options) {
// id is any valid conversation identifier
const conversation = this.get(id);

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(

View file

@ -164,17 +164,17 @@
"rule": "jQuery-load(",
"path": "js/conversation_controller.js",
"line": " async load() {",
"lineNumber": 210,
"lineNumber": 215,
"reasonCategory": "falseMatch",
"updated": "2020-02-14T20:02:37.507Z"
"updated": "2020-03-24T20:06:31.391Z"
},
{
"rule": "jQuery-load(",
"path": "js/conversation_controller.js",
"line": " this._initialPromise = load();",
"lineNumber": 255,
"lineNumber": 260,
"reasonCategory": "falseMatch",
"updated": "2020-02-14T20:02:37.507Z"
"updated": "2020-03-24T20:06:31.391Z"
},
{
"rule": "jQuery-$(",