new attribute "hide_in_autocomplete", fixes #16

This commit is contained in:
azivner
2018-02-13 22:30:33 -05:00
parent 1cef0ce5f9
commit 2e8eeda5ab
6 changed files with 33 additions and 2 deletions

View File

@@ -14,6 +14,8 @@ const noteTree = (function() {
let parentChildToNoteTreeId = {};
let noteIdToTitle = {};
let hiddenInAutocomplete = {};
function getNoteTreeId(parentNoteId, childNoteId) {
assertArguments(parentNoteId, childNoteId);
@@ -648,6 +650,12 @@ const noteTree = (function() {
startNotePath = getNotePathFromAddress();
}
hiddenInAutocomplete = {};
for (const noteId of resp.hiddenInAutocomplete) {
hiddenInAutocomplete[noteId] = true;
}
return prepareNoteTree(resp.notes);
}
@@ -705,6 +713,10 @@ const noteTree = (function() {
const autocompleteItems = [];
for (const childNoteId of parentToChildren[parentNoteId]) {
if (hiddenInAutocomplete[childNoteId]) {
continue;
}
const childNotePath = (notePath ? (notePath + '/') : '') + childNoteId;
const childTitlePath = (titlePath ? (titlePath + ' / ') : '') + getNoteTitle(childNoteId, parentNoteId);