1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-11-29 22:48:10 +02:00

Desktop, Mobile: Fixes #12097: Add ability to delete all history for individual notes (#12381)

This commit is contained in:
mrjo118
2025-06-07 12:52:55 +01:00
committed by GitHub
parent 73ed17e851
commit a47d7906af
6 changed files with 94 additions and 2 deletions

View File

@@ -373,6 +373,15 @@ export default class Revision extends BaseItem {
}
}
public static async deleteHistoryForNote(noteId: string) {
const revisions: RevisionEntity[] = await this.modelSelectAll(
'SELECT id FROM revisions WHERE item_type = ? AND item_id = ? ORDER BY item_updated_time DESC',
[ModelType.Note, noteId],
);
await this.batchDelete(revisions.map(item => item.id), { sourceDescription: 'Revision.deleteHistoryForNote' });
}
public static async revisionExists(itemType: ModelType, itemId: string, updatedTime: number) {
const existingRev = await Revision.latestRevision(itemType, itemId);
return existingRev && existingRev.item_updated_time === updatedTime;