mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 10:26:08 +01:00 
			
		
		
		
	fix occurrences of 'root' branch
This commit is contained in:
		| @@ -13,7 +13,7 @@ describe("Search", () => { | ||||
|         becca.reset(); | ||||
|  | ||||
|         rootNote = new NoteBuilder(new Note({noteId: 'root', title: 'root', type: 'text'})); | ||||
|         new Branch({branchId: 'root', noteId: 'root', parentNoteId: 'none', notePosition: 10}); | ||||
|         new Branch({branchId: 'none_root', noteId: 'root', parentNoteId: 'none', notePosition: 10}); | ||||
|     }); | ||||
|  | ||||
|     it("simple path match", () => { | ||||
|   | ||||
| @@ -180,7 +180,7 @@ function getNotePath(noteId) { | ||||
|         let branchId; | ||||
|  | ||||
|         if (note.isRoot()) { | ||||
|             branchId = 'root'; | ||||
|             branchId = 'none_root'; | ||||
|         } | ||||
|         else { | ||||
|             const parentNote = note.parents[0]; | ||||
|   | ||||
| @@ -10,7 +10,9 @@ async function moveBeforeBranch(branchIdsToMove, beforeBranchId) { | ||||
|     branchIdsToMove = filterRootNote(branchIdsToMove); | ||||
|     branchIdsToMove = filterSearchBranches(branchIdsToMove); | ||||
|  | ||||
|     if (['root', '_lbRoot', '_lbAvailableLaunchers', '_lbVisibleLaunchers'].includes(beforeBranchId)) { | ||||
|     const beforeBranch = await froca.getBranch(beforeBranchId); | ||||
|  | ||||
|     if (['root', '_lbRoot', '_lbAvailableLaunchers', '_lbVisibleLaunchers'].includes(beforeBranch.noteId)) { | ||||
|         toastService.showError('Cannot move notes here.'); | ||||
|         return; | ||||
|     } | ||||
|   | ||||
| @@ -637,7 +637,7 @@ export default class NoteTreeWidget extends NoteContextAwareWidget { | ||||
|     } | ||||
|  | ||||
|     prepareRootNode() { | ||||
|         return this.prepareNode(froca.getBranch('root')); | ||||
|         return this.prepareNode(froca.getBranch('none_root')); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|   | ||||
| @@ -143,7 +143,7 @@ function setExpanded(req) { | ||||
|     const {branchId} = req.params; | ||||
|     const expanded = parseInt(req.params.expanded); | ||||
|  | ||||
|     if (branchId !== 'root') { | ||||
|     if (branchId !== 'none_root') { | ||||
|         sql.execute("UPDATE branches SET isExpanded = ? WHERE branchId = ?", [expanded, branchId]); | ||||
|         // we don't sync expanded label | ||||
|         // also this does not trigger updates to the frontend, this would trigger too many reloads | ||||
| @@ -172,7 +172,7 @@ function setExpandedForSubtree(req) { | ||||
|         SELECT branchId FROM tree`, [branchId]); | ||||
|  | ||||
|     // root is always expanded | ||||
|     branchIds = branchIds.filter(branchId => branchId !== 'root'); | ||||
|     branchIds = branchIds.filter(branchId => branchId !== 'none_root'); | ||||
|  | ||||
|     sql.executeMany(`UPDATE branches SET isExpanded = ${expanded} WHERE branchId IN (???)`, branchIds); | ||||
|  | ||||
|   | ||||
| @@ -66,7 +66,7 @@ function getNotesAndBranchesAndAttributes(noteIds) { | ||||
|  | ||||
|     if (noteIds.has('root')) { | ||||
|         branches.push({ | ||||
|             branchId: 'root', | ||||
|             branchId: 'none_root', | ||||
|             noteId: 'root', | ||||
|             parentNoteId: 'none', | ||||
|             notePosition: 0, | ||||
|   | ||||
| @@ -77,7 +77,6 @@ async function createInitialDatabase() { | ||||
|         rootNote.setContent(''); | ||||
|  | ||||
|         new Branch({ | ||||
|             branchId: 'root', | ||||
|             noteId: 'root', | ||||
|             parentNoteId: 'none', | ||||
|             isExpanded: true, | ||||
|   | ||||
		Reference in New Issue
	
	Block a user