fix finding note paths of hidden notes, fixes #2262

This commit is contained in:
zadam 2021-10-24 14:37:41 +02:00
parent 6e0a65b59c
commit 33aa72eb97
5 changed files with 8 additions and 9 deletions

View file

@ -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();
}
}

View file

@ -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;
}

View file

@ -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);

View file

@ -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;

View file

@ -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');