Properly retry story messages

This commit is contained in:
Josh Perez 2022-12-22 19:48:09 -05:00 committed by GitHub
parent 55a1c5f6c5
commit 1b3a631903
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1383,20 +1383,38 @@ export class MessageModel extends window.Backbone.Model<MessageAttributesType> {
this.set('sendStateByConversationId', newSendStateByConversationId); this.set('sendStateByConversationId', newSendStateByConversationId);
await conversationJobQueue.add( if (isStory(this.attributes)) {
{ await conversationJobQueue.add(
type: conversationQueueJobEnum.enum.NormalMessage, {
conversationId: conversation.id, type: conversationQueueJobEnum.enum.Story,
messageId: this.id, conversationId: conversation.id,
revision: conversation.get('revision'), messageIds: [this.id],
}, // using the group timestamp, which will differ from the 1:1 timestamp
async jobToInsert => { timestamp: this.attributes.timestamp,
await window.Signal.Data.saveMessage(this.attributes, { },
jobToInsert, async jobToInsert => {
ourUuid: window.textsecure.storage.user.getCheckedUuid().toString(), await window.Signal.Data.saveMessage(this.attributes, {
}); jobToInsert,
} ourUuid: window.textsecure.storage.user.getCheckedUuid().toString(),
); });
}
);
} else {
await conversationJobQueue.add(
{
type: conversationQueueJobEnum.enum.NormalMessage,
conversationId: conversation.id,
messageId: this.id,
revision: conversation.get('revision'),
},
async jobToInsert => {
await window.Signal.Data.saveMessage(this.attributes, {
jobToInsert,
ourUuid: window.textsecure.storage.user.getCheckedUuid().toString(),
});
}
);
}
} }
isReplayableError(e: Error): boolean { isReplayableError(e: Error): boolean {