Skip to content

Build your personal knowledge base with Trilium Notes

make "excludeFromNoteMap" overridable with note.isLabelTruthy(), #4058

zadam430f2975f897
diff --git a/src/routes/api/note_map.js b/src/routes/api/note_map.js
index 4ef64a3999..d0b2c12547 100644
--- a/src/routes/api/note_map.js
+++ b/src/routes/api/note_map.js
@@ -57,7 +57,7 @@ function getNeighbors(note, depth) {
const targetNote = relation.getTargetNote();
- if (!targetNote || targetNote.hasLabel('excludeFromNoteMap')) {
+ if (!targetNote || targetNote.isLabelTruthy('excludeFromNoteMap')) {
continue;
}
@@ -76,7 +76,7 @@ function getNeighbors(note, depth) {
const sourceNote = relation.getNote();
- if (!sourceNote || sourceNote.hasLabel('excludeFromNoteMap')) {
+ if (!sourceNote || sourceNote.isLabelTruthy('excludeFromNoteMap')) {
continue;
}
@@ -94,7 +94,7 @@ function getLinkMap(req) {
const mapRootNote = becca.getNote(req.params.noteId);
// if the map root itself has exclude attribute (journal typically) then there wouldn't be anything to display, so
// we'll just ignore it
- const ignoreExcludeFromNoteMap = mapRootNote.hasLabel('excludeFromNoteMap');
+ const ignoreExcludeFromNoteMap = mapRootNote.isLabelTruthy('excludeFromNoteMap');
let unfilteredNotes;
if (mapRootNote.type === 'search') {
@@ -110,7 +110,7 @@ function getLinkMap(req) {
const noteIds = new Set(
unfilteredNotes
- .filter(note => ignoreExcludeFromNoteMap || !note.hasLabel('excludeFromNoteMap'))
+ .filter(note => ignoreExcludeFromNoteMap || !note.isLabelTruthy('excludeFromNoteMap'))
.map(note => note.noteId)
);
@@ -169,7 +169,7 @@ function getTreeMap(req) {
const mapRootNote = becca.getNote(req.params.noteId);
// if the map root itself has ignore (journal typically) then there wouldn't be anything to display, so
// we'll just ignore it
- const ignoreExcludeFromNoteMap = mapRootNote.hasLabel('excludeFromNoteMap');
+ const ignoreExcludeFromNoteMap = mapRootNote.isLabelTruthy('excludeFromNoteMap');
const subtree = mapRootNote.getSubtree({
includeArchived: false,
resolveSearch: true,
@@ -177,7 +177,7 @@ function getTreeMap(req) {
});
const notes = subtree.notes
- .filter(note => ignoreExcludeFromNoteMap || !note.hasLabel('excludeFromNoteMap'))
+ .filter(note => ignoreExcludeFromNoteMap || !note.isLabelTruthy('excludeFromNoteMap'))
.filter(note => {
if (note.type !== 'image' || note.getChildNotes().length > 0) {
return true;