mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-04 05:28:59 +01:00 
			
		
		
		
	fix finding note paths of hidden notes, fixes #2262
This commit is contained in:
		
							parent
							
								
									6e0a65b59c
								
							
						
					
					
						commit
						33aa72eb97
					
				@ -45,6 +45,10 @@ function load() {
 | 
				
			|||||||
        new Option(row);
 | 
					        new Option(row);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    for (const noteId in becca.notes) {
 | 
				
			||||||
 | 
					        becca.notes[noteId].sortParents();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    becca.loaded = true;
 | 
					    becca.loaded = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    log.info(`Becca (note cache) load took ${Date.now() - start}ms`);
 | 
					    log.info(`Becca (note cache) load took ${Date.now() - start}ms`);
 | 
				
			||||||
@ -151,7 +155,7 @@ function branchUpdated(branch) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    if (childNote) {
 | 
					    if (childNote) {
 | 
				
			||||||
        childNote.flatTextCache = null;
 | 
					        childNote.flatTextCache = null;
 | 
				
			||||||
        childNote.resortParents();
 | 
					        childNote.sortParents();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -125,7 +125,7 @@ function getNoteTitleForPath(notePathArray) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Returns notePath for noteId from cache. Note hoisting is respected.
 | 
					 * Returns notePath for noteId from cache. Note hoisting is respected.
 | 
				
			||||||
 * Archived notes are also returned, but non-archived paths are preferred if available
 | 
					 * Archived (and hidden) notes are also returned, but non-archived paths are preferred if available
 | 
				
			||||||
 * - this means that archived paths is returned only if there's no non-archived path
 | 
					 * - this means that archived paths is returned only if there's no non-archived path
 | 
				
			||||||
 * - you can check whether returned path is archived using isArchived
 | 
					 * - you can check whether returned path is archived using isArchived
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
@ -140,10 +140,6 @@ function getSomePathInner(note, path, respectHoisting) {
 | 
				
			|||||||
        path.push(note.noteId);
 | 
					        path.push(note.noteId);
 | 
				
			||||||
        path.reverse();
 | 
					        path.reverse();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (path.includes("hidden")) {
 | 
					 | 
				
			||||||
            return false;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if (respectHoisting && !path.includes(cls.getHoistedNoteId())) {
 | 
					        if (respectHoisting && !path.includes(cls.getHoistedNoteId())) {
 | 
				
			||||||
            return false;
 | 
					            return false;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
				
			|||||||
@ -611,7 +611,7 @@ class Note extends AbstractEntity {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    // will sort the parents so that non-search & non-archived are first and archived at the end
 | 
					    // will sort the parents so that non-search & non-archived are first and archived at the end
 | 
				
			||||||
    // this is done so that non-search & non-archived paths are always explored as first when looking for note path
 | 
					    // this is done so that non-search & non-archived paths are always explored as first when looking for note path
 | 
				
			||||||
    resortParents() {
 | 
					    sortParents() {
 | 
				
			||||||
        this.parentBranches.sort((a, b) =>
 | 
					        this.parentBranches.sort((a, b) =>
 | 
				
			||||||
            a.branchId.startsWith('virt-')
 | 
					            a.branchId.startsWith('virt-')
 | 
				
			||||||
            || a.parentNote.hasInheritableOwnedArchivedLabel() ? 1 : -1);
 | 
					            || a.parentNote.hasInheritableOwnedArchivedLabel() ? 1 : -1);
 | 
				
			||||||
 | 
				
			|||||||
@ -153,7 +153,7 @@ class NoteListRenderer {
 | 
				
			|||||||
        this.parentNote = parentNote;
 | 
					        this.parentNote = parentNote;
 | 
				
			||||||
        const includedNoteIds = this.getIncludedNoteIds();
 | 
					        const includedNoteIds = this.getIncludedNoteIds();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        this.noteIds = noteIds.filter(noteId => !includedNoteIds.has(noteId));
 | 
					        this.noteIds = noteIds.filter(noteId => !includedNoteIds.has(noteId) && noteId !== 'hidden');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (this.noteIds.length === 0) {
 | 
					        if (this.noteIds.length === 0) {
 | 
				
			||||||
            return;
 | 
					            return;
 | 
				
			||||||
 | 
				
			|||||||
@ -3,7 +3,6 @@
 | 
				
			|||||||
const lex = require('./lex');
 | 
					const lex = require('./lex');
 | 
				
			||||||
const handleParens = require('./handle_parens');
 | 
					const handleParens = require('./handle_parens');
 | 
				
			||||||
const parse = require('./parse');
 | 
					const parse = require('./parse');
 | 
				
			||||||
const NoteSet = require("../note_set");
 | 
					 | 
				
			||||||
const SearchResult = require("../search_result");
 | 
					const SearchResult = require("../search_result");
 | 
				
			||||||
const SearchContext = require("../search_context");
 | 
					const SearchContext = require("../search_context");
 | 
				
			||||||
const becca = require('../../../becca/becca');
 | 
					const becca = require('../../../becca/becca');
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user