You've already forked joplin
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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user