1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-12-14 23:26:58 +02:00

Desktop, Mobile: Fix historic issue whereby the first revision created for a note does not contain the original contents (#12674)

Co-authored-by: Laurent Cozic <laurent22@users.noreply.github.com>
This commit is contained in:
mrjo118
2025-10-09 22:35:08 +01:00
committed by GitHub
parent af5287de99
commit 53035839a5
5 changed files with 251 additions and 17 deletions

View File

@@ -1,5 +1,7 @@
import { _ } from '../../../locale';
import ItemChange from '../../../models/ItemChange';
import Revision from '../../../models/Revision';
import RevisionService from '../../../services/RevisionService';
import shim, { MessageBoxType } from '../../../shim';
const { useCallback } = shim.react();
@@ -23,7 +25,12 @@ const useDeleteHistoryClick = ({
if (response === 0) {
setDeleting(true);
try {
// Ensure that if the user explicitly deletes all revisions for a note, any new revisions created upon revision collection do not include
// contents which were present prior to triggering the deletion
await Revision.deleteHistoryForNote(noteId, { sourceDescription: 'useDeleteHistoryClick' });
await ItemChange.updateOldNoteContent(noteId, null);
RevisionService.instance().removeChangedSinceCollection(noteId);
await shim.showMessageBox(_('Note history has been deleted.'), { type: MessageBoxType.Info });
} finally {
setDeleting(false);