only forceSave when we are creating a new message

This commit is contained in:
Jamie Kyle 2023-03-20 11:06:34 -07:00 committed by GitHub
parent 75d5e81013
commit 27b7060d09
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3310,6 +3310,8 @@ export class ConversationModel extends window.Backbone
callHistoryDetails: detailsToSave,
};
// Force save if we're adding a new call history message for a direct call
let forceSave = true;
if (callHistoryDetails.callMode === CallMode.Direct) {
const messageId =
await window.Signal.Data.getCallHistoryMessageByCallId(
@ -3321,6 +3323,8 @@ export class ConversationModel extends window.Backbone
`addCallHistory: Found existing call history message (Call ID: ${callHistoryDetails.callId}, Message ID: ${messageId})`
);
message.id = messageId;
// We don't want to force save if we're updating an existing message
forceSave = false;
} else {
log.info(
`addCallHistory: No existing call history message found (Call ID: ${callHistoryDetails.callId})`
@ -3330,7 +3334,7 @@ export class ConversationModel extends window.Backbone
const id = await window.Signal.Data.saveMessage(message, {
ourUuid: window.textsecure.storage.user.getCheckedUuid().toString(),
forceSave: true,
forceSave,
});
log.info(`addCallHistory: Saved call history message (ID: ${id})`);