diff --git a/src/becca/becca_loader.js b/src/becca/becca_loader.js index 7018110a0..4d18ad17c 100644 --- a/src/becca/becca_loader.js +++ b/src/becca/becca_loader.js @@ -45,6 +45,10 @@ function load() { new Option(row); } + for (const noteId in becca.notes) { + becca.notes[noteId].sortParents(); + } + becca.loaded = true; log.info(`Becca (note cache) load took ${Date.now() - start}ms`); @@ -151,7 +155,7 @@ function branchUpdated(branch) { if (childNote) { childNote.flatTextCache = null; - childNote.resortParents(); + childNote.sortParents(); } } diff --git a/src/becca/becca_service.js b/src/becca/becca_service.js index afea5af03..92037178b 100644 --- a/src/becca/becca_service.js +++ b/src/becca/becca_service.js @@ -125,7 +125,7 @@ function getNoteTitleForPath(notePathArray) { /** * 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 * - you can check whether returned path is archived using isArchived */ @@ -140,10 +140,6 @@ function getSomePathInner(note, path, respectHoisting) { path.push(note.noteId); path.reverse(); - if (path.includes("hidden")) { - return false; - } - if (respectHoisting && !path.includes(cls.getHoistedNoteId())) { return false; } diff --git a/src/becca/entities/note.js b/src/becca/entities/note.js index 91abb37c6..32c9b7fc3 100644 --- a/src/becca/entities/note.js +++ b/src/becca/entities/note.js @@ -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 // 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) => a.branchId.startsWith('virt-') || a.parentNote.hasInheritableOwnedArchivedLabel() ? 1 : -1); diff --git a/src/public/app/services/note_list_renderer.js b/src/public/app/services/note_list_renderer.js index 91b266993..8dc5b8e98 100644 --- a/src/public/app/services/note_list_renderer.js +++ b/src/public/app/services/note_list_renderer.js @@ -153,7 +153,7 @@ class NoteListRenderer { this.parentNote = parentNote; 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) { return; diff --git a/src/services/search/services/search.js b/src/services/search/services/search.js index 030580fcb..d43ad6930 100644 --- a/src/services/search/services/search.js +++ b/src/services/search/services/search.js @@ -3,7 +3,6 @@ const lex = require('./lex'); const handleParens = require('./handle_parens'); const parse = require('./parse'); -const NoteSet = require("../note_set"); const SearchResult = require("../search_result"); const SearchContext = require("../search_context"); const becca = require('../../../becca/becca');