Fix out-of-order applications of reaction and delete-for-everyone
This commit is contained in:
parent
05f905fd10
commit
e8759fc81b
3 changed files with 14 additions and 12 deletions
|
@ -14,7 +14,7 @@
|
||||||
forMessage(message) {
|
forMessage(message) {
|
||||||
const matchingDeletes = this.filter({
|
const matchingDeletes = this.filter({
|
||||||
targetSentTimestamp: message.get('sent_at'),
|
targetSentTimestamp: message.get('sent_at'),
|
||||||
fromId: message.getContact().get('id'),
|
fromId: message.getContactId(),
|
||||||
});
|
});
|
||||||
|
|
||||||
if (matchingDeletes.length > 0) {
|
if (matchingDeletes.length > 0) {
|
||||||
|
|
|
@ -24,15 +24,15 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const senderId = message.getContactId();
|
||||||
|
const sentAt = message.get('sent_at');
|
||||||
const reactionsBySource = this.filter(re => {
|
const reactionsBySource = this.filter(re => {
|
||||||
const mcid = message.get('conversationId');
|
const targetSenderId = ConversationController.ensureContactIds({
|
||||||
const recid = ConversationController.ensureContactIds({
|
|
||||||
e164: re.get('targetAuthorE164'),
|
e164: re.get('targetAuthorE164'),
|
||||||
uuid: re.get('targetAuthorUuid'),
|
uuid: re.get('targetAuthorUuid'),
|
||||||
});
|
});
|
||||||
const mTime = message.get('sent_at');
|
const targetTimestamp = re.get('targetTimestamp');
|
||||||
const rTime = re.get('targetTimestamp');
|
return targetSenderId === senderId && targetTimestamp === sentAt;
|
||||||
return mcid === recid && mTime === rTime;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (reactionsBySource.length > 0) {
|
if (reactionsBySource.length > 0) {
|
||||||
|
|
|
@ -3344,16 +3344,18 @@ export class MessageModel extends window.Backbone.Model<MessageAttributesType> {
|
||||||
|
|
||||||
// Does this message have any pending, previously-received associated reactions?
|
// Does this message have any pending, previously-received associated reactions?
|
||||||
const reactions = window.Whisper.Reactions.forMessage(message);
|
const reactions = window.Whisper.Reactions.forMessage(message);
|
||||||
reactions.forEach(reaction => {
|
await Promise.all(
|
||||||
message.handleReaction(reaction, false);
|
reactions.map(reaction => message.handleReaction(reaction, false))
|
||||||
});
|
);
|
||||||
|
|
||||||
// Does this message have any pending, previously-received associated
|
// Does this message have any pending, previously-received associated
|
||||||
// delete for everyone messages?
|
// delete for everyone messages?
|
||||||
const deletes = window.Whisper.Deletes.forMessage(message);
|
const deletes = window.Whisper.Deletes.forMessage(message);
|
||||||
deletes.forEach(del => {
|
await Promise.all(
|
||||||
window.Signal.Util.deleteForEveryone(message, del, false);
|
deletes.map(del =>
|
||||||
});
|
window.Signal.Util.deleteForEveryone(message, del, false)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
await window.Signal.Data.saveMessage(message.attributes, {
|
await window.Signal.Data.saveMessage(message.attributes, {
|
||||||
Message: window.Whisper.Message,
|
Message: window.Whisper.Message,
|
||||||
|
|
Loading…
Reference in a new issue