note map refactoring

This commit is contained in:
zadam
2021-09-20 23:04:41 +02:00
parent e4ba7d65e8
commit 476b8250c9
7 changed files with 40 additions and 20 deletions

View File

@@ -101,11 +101,12 @@ function buildDescendantCountMap() {
return noteIdToCountMap;
}
function getGlobalLinkMap() {
function getGlobalLinkMap(req) {
const mapRootNote = becca.getNote(req.params.noteId);
const noteIds = new Set();
const notes = Object.values(becca.notes)
.filter(note => !note.isArchived)
const notes = mapRootNote.getSubtreeNotes(false)
.map(note => [
note.noteId,
note.isContentAvailable() ? note.title : '[protected]',
@@ -144,11 +145,12 @@ function getGlobalLinkMap() {
};
}
function getGlobalTreeMap() {
function getGlobalTreeMap(req) {
const mapRootNote = becca.getNote(req.params.noteId);
const noteIds = new Set();
const notes = Object.values(becca.notes)
.filter(note => !note.isArchived && !note.hasLabel('excludeFromTreeMap'))
const notes = mapRootNote.getSubtreeNotes(false)
.filter(note => !note.hasLabel('excludeFromTreeMap'))
.map(note => [
note.noteId,
note.isContentAvailable() ? note.title : '[protected]',