From 1db892d22f07012dd58a61c8e70ff44160b59753 Mon Sep 17 00:00:00 2001 From: zadam Date: Mon, 8 Jun 2020 23:15:49 +0200 Subject: [PATCH] return the ability to hide archived notes, closes #1095 --- src/public/app/widgets/note_tree.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/public/app/widgets/note_tree.js b/src/public/app/widgets/note_tree.js index a4006fe19..bba40add5 100644 --- a/src/public/app/widgets/note_tree.js +++ b/src/public/app/widgets/note_tree.js @@ -576,7 +576,17 @@ export default class NoteTreeWidget extends TabAwareWidget { const noteList = []; + const hideArchivedNotes = this.hideArchivedNotes; + for (const branch of this.getChildBranches(parentNote)) { + if (hideArchivedNotes) { + const note = await branch.getNote(); + + if (note.hasLabel('archived')) { + continue; + } + } + const node = await this.prepareNode(branch); noteList.push(node); @@ -600,6 +610,11 @@ export default class NoteTreeWidget extends TabAwareWidget { childBranches = childBranches.filter(branch => !imageLinks.find(rel => rel.value === branch.noteId)); } + // we're not checking hideArchivedNotes since that would mean we need to lazy load the child notes + // which would seriously slow down everything. + // we check this flag only once user chooses to expand the parent. This has the negative consequence that + // note may appear as folder but not contain any children when all of them are archived + return childBranches; }