mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-30 18:05:55 +01:00 
			
		
		
		
	fix consistency check to re-parent note from search parent to root
This commit is contained in:
		| @@ -443,10 +443,17 @@ class ConsistencyChecks { | |||||||
|                     const branches = branchIds.map(branchId => becca.getBranch(branchId)); |                     const branches = branchIds.map(branchId => becca.getBranch(branchId)); | ||||||
|  |  | ||||||
|                     for (const branch of branches) { |                     for (const branch of branches) { | ||||||
|                         branch.parentNoteId = 'root'; |                         // delete the old wrong branch | ||||||
|                         branch.save(); |                         branch.markAsDeleted("parent-is-search"); | ||||||
|  |  | ||||||
|                         logFix(`Child branch '${branch.branchId}' has been moved to root since it was a child of a search note '${parentNoteId}'`) |                         // create a replacement branch in root parent | ||||||
|  |                         new Branch({ | ||||||
|  |                             parentNoteId: 'root', | ||||||
|  |                             noteId: branch.noteId, | ||||||
|  |                             prefix: 'recovered' | ||||||
|  |                         }).save(); | ||||||
|  |  | ||||||
|  |                         logFix(`Note '${branch.noteId}' has been moved to root since it was a child of a search note '${parentNoteId}'`) | ||||||
|                     } |                     } | ||||||
|  |  | ||||||
|                     this.reloadNeeded = true; |                     this.reloadNeeded = true; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user