mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 10:26:08 +01:00 
			
		
		
		
	delete/undelete fixes
This commit is contained in:
		| @@ -418,14 +418,16 @@ async function deleteBranch(branch, deleteId, taskContext) { | ||||
|     const notDeletedBranches = await note.getBranches(); | ||||
|  | ||||
|     if (notDeletedBranches.length === 0) { | ||||
|         note.isDeleted = true; | ||||
|         note.deleteId = deleteId; | ||||
|         await note.save(); | ||||
|  | ||||
|         for (const childBranch of await note.getChildBranches()) { | ||||
|             await deleteBranch(childBranch, deleteId, taskContext); | ||||
|         } | ||||
|  | ||||
|         // first delete children and then parent - this will show up better in recent changes | ||||
|  | ||||
|         note.isDeleted = true; | ||||
|         note.deleteId = deleteId; | ||||
|         await note.save(); | ||||
|  | ||||
|         for (const attribute of await note.getOwnedAttributes()) { | ||||
|             attribute.isDeleted = true; | ||||
|             attribute.deleteId = deleteId; | ||||
| @@ -508,7 +510,7 @@ async function undeleteBranch(branch, deleteId, taskContext) { | ||||
|               AND branches.parentNoteId = ?`, [deleteId, note.noteId]); | ||||
|  | ||||
|         for (const childBranch of childBranches) { | ||||
|             await deleteBranch(childBranch, deleteId, taskContext); | ||||
|             await undeleteBranch(childBranch, deleteId, taskContext); | ||||
|         } | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -2,7 +2,6 @@ const sql = require('./sql'); | ||||
| const ScriptContext = require('./script_context'); | ||||
| const repository = require('./repository'); | ||||
| const cls = require('./cls'); | ||||
| const sourceIdService = require('./source_id'); | ||||
| const log = require('./log'); | ||||
|  | ||||
| async function executeNote(note, apiParams) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user