modifyTargetMessage: Save other changes before applying edits

This commit is contained in:
Scott Nonnenberg 2024-02-12 11:13:09 -08:00 committed by GitHub
parent 63146d2aba
commit d9212108a3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -250,6 +250,14 @@ export async function modifyTargetMessage(
})
);
// We save here before handling any edits because handleEditMessage does its own saves
if (changed && !isFirstRun) {
log.info(`${logId}: Changes in second run; saving.`);
await window.Signal.Data.saveMessage(message.attributes, {
ourAci,
});
}
// We want to make sure the message is saved first before applying any edits
if (!isFirstRun && !skipEdits) {
const edits = Edits.forMessage(message.attributes);
@ -262,11 +270,4 @@ export async function modifyTargetMessage(
)
);
}
if (changed && !isFirstRun) {
log.info(`${logId}: Changes in second run; saving.`);
await window.Signal.Data.saveMessage(message.attributes, {
ourAci,
});
}
}