From a0de3c97a5f3c197f489fd00f3ddc32c8f276372 Mon Sep 17 00:00:00 2001 From: zadam Date: Sun, 6 Jun 2021 11:13:17 +0200 Subject: [PATCH] note paths widget does not show hidden path --- src/public/app/entities/note_short.js | 3 ++- .../app/widgets/ribbon_widgets/note_paths.js | 15 +++++++++++++-- src/routes/api/date_notes.js | 4 +++- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/public/app/entities/note_short.js b/src/public/app/entities/note_short.js index 1fa815344..ca6bcfc01 100644 --- a/src/public/app/entities/note_short.js +++ b/src/public/app/entities/note_short.js @@ -300,7 +300,8 @@ class NoteShort { notePath: path, isInHoistedSubTree: path.includes(hoistedNotePath), isArchived: path.find(noteId => froca.notes[noteId].hasLabel('archived')), - isSearch: path.find(noteId => froca.notes[noteId].type === 'search') + isSearch: path.find(noteId => froca.notes[noteId].type === 'search'), + isHidden: path.includes("hidden") })); notePaths.sort((a, b) => { diff --git a/src/public/app/widgets/ribbon_widgets/note_paths.js b/src/public/app/widgets/ribbon_widgets/note_paths.js index 8a4cdd03c..ab8496a3b 100644 --- a/src/public/app/widgets/ribbon_widgets/note_paths.js +++ b/src/public/app/widgets/ribbon_widgets/note_paths.js @@ -28,7 +28,7 @@ const TPL = ` } -
This note is placed into the following paths:
+
@@ -51,6 +51,7 @@ export default class NotePathsWidget extends NoteContextAwareWidget { doRender() { this.$widget = $(TPL); + this.$notePathIntro = this.$widget.find(".note-path-intro"); this.$notePathList = this.$widget.find(".note-path-list"); this.$widget.on('show.bs.dropdown', () => this.renderDropdown()); } @@ -63,7 +64,17 @@ export default class NotePathsWidget extends NoteContextAwareWidget { return; } - for (const notePathRecord of this.note.getSortedNotePaths(this.hoistedNoteId)) { + const sortedNotePaths = this.note.getSortedNotePaths(this.hoistedNoteId) + .filter(notePath => !notePath.isHidden); + + if (sortedNotePaths.length > 0) { + this.$notePathIntro.text("This note is placed into the following paths:"); + } + else { + this.$notePathIntro.text("This note is not yet placed into the note tree."); + } + + for (const notePathRecord of sortedNotePaths) { await this.addPath(notePathRecord); } } diff --git a/src/routes/api/date_notes.js b/src/routes/api/date_notes.js index ae3ce257d..499b4390a 100644 --- a/src/routes/api/date_notes.js +++ b/src/routes/api/date_notes.js @@ -92,7 +92,9 @@ function getHiddenRoot() { parentNoteId: 'root' }).note; - hidden.addLabel('archived', "", true); + // isInheritable: false means that this notePath is automatically not preffered but at the same time + // the flag is not inherited to the children + hidden.addLabel('archived', "", false); } return hidden;