conversation.applyMessageRequestResponse: Always save at the end

This commit is contained in:
Scott Nonnenberg 2020-11-12 12:03:07 -08:00 committed by GitHub
parent 947e9c366c
commit 0c6f4248f3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1307,6 +1307,7 @@ export class ConversationModel extends window.Backbone.Model<
response: number,
{ fromSync = false, viaStorageServiceSync = false } = {}
): Promise<void> {
try {
const messageRequestEnum =
window.textsecure.protobuf.SyncMessage.MessageRequestResponse.Type;
const isLocalAction = !fromSync && !viaStorageServiceSync;
@ -1320,14 +1321,13 @@ export class ConversationModel extends window.Backbone.Model<
this.set({
messageRequestResponseType: response,
});
window.Signal.Data.updateConversation(this.attributes);
if (response === messageRequestEnum.ACCEPT) {
this.unblock({ viaStorageServiceSync });
this.enableProfileSharing({ viaStorageServiceSync });
// We really don't want to call this if we don't have to. It can take a lot of time
// to go through old messages to download attachments.
// We really don't want to call this if we don't have to. It can take a lot of
// time to go through old messages to download attachments.
if (didResponseChange && !wasPreviouslyAccepted) {
await this.handleReadAndDownloadAttachments({ isLocalAction });
}
@ -1408,6 +1408,9 @@ export class ConversationModel extends window.Backbone.Model<
}
}
}
} finally {
window.Signal.Data.updateConversation(this.attributes);
}
}
async leaveGroupV2(): Promise<void> {