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; return null;
}, },
getOurConversationId() {
const e164 = textsecure.storage.user.getNumber();
const uuid = textsecure.storage.user.getUuid();
return this.getConversationId(e164 || uuid);
},
prepareForSend(id, options) { prepareForSend(id, options) {
// id is any valid conversation identifier // id is any valid conversation identifier
const conversation = this.get(id); const conversation = this.get(id);

View file

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

View file

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