Fix uncaught error in markMessageRead

This commit is contained in:
Fedor Indutny 2021-07-30 15:13:52 -07:00 committed by GitHub
parent eccace481b
commit 926283a114
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1267,7 +1267,7 @@ export class ConversationModel extends window.Backbone
this.debouncedUpdateLastMessage!();
}
addSingleMessage(message: MessageModel): MessageModel {
addSingleMessage(message: MessageModel): void {
const { messagesAdded } = window.reduxActions.conversations;
const isNewMessage = true;
messagesAdded(
@ -1276,8 +1276,6 @@ export class ConversationModel extends window.Backbone
isNewMessage,
window.isActive()
);
return message;
}
// For incoming messages, they might arrive while we're in the middle of a bulk fetch
@ -3622,18 +3620,18 @@ export class ConversationModel extends window.Backbone
id: window.getGuid(),
};
const model = this.addSingleMessage(
new window.Whisper.Message(attributes)
);
if (sticker) {
await addStickerPackReference(model.id, sticker.packId);
}
const model = new window.Whisper.Message(attributes);
const message = window.MessageController.register(model.id, model);
const messageId = message.id;
await window.Signal.Data.saveMessage(message.attributes, {
forceSave: true,
});
this.addSingleMessage(model);
if (sticker) {
await addStickerPackReference(model.id, sticker.packId);
}
const messageId = message.id;
const draftProperties = dontClearDraft
? {}
: {