From c85ec957ecf6721a55416838f4feeb737b5cfd84 Mon Sep 17 00:00:00 2001 From: sigaloid <69441971+sigaloid@users.noreply.github.com> Date: Thu, 18 Aug 2022 23:12:58 -0400 Subject: [PATCH] Filter excludeFromNoteMap from backlinks --- src/routes/api/note_map.js | 2 +- src/routes/api/notes.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/routes/api/note_map.js b/src/routes/api/note_map.js index be07f3fe4..45b438d89 100644 --- a/src/routes/api/note_map.js +++ b/src/routes/api/note_map.js @@ -299,7 +299,7 @@ function getBacklinks(req) { let backlinksWithExcerptCount = 0; - return backlinks.map(backlink => { + return backlinks.filter(note => !note.getNote().hasLabel('excludeFromNoteMap')).map(backlink => { const sourceNote = backlink.note; if (sourceNote.type !== 'text' || backlinksWithExcerptCount > 50) { diff --git a/src/routes/api/notes.js b/src/routes/api/notes.js index bb4935303..d21addaad 100644 --- a/src/routes/api/notes.js +++ b/src/routes/api/notes.js @@ -315,7 +315,7 @@ function getBacklinkCount(req) { } else { return { - count: note.getTargetRelations().length + count: note.getTargetRelations().filter(note => !note.getNote().hasLabel('excludeFromNoteMap')).length }; } }