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

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,
});
}
}