autocomplete doesn't show clones and encrypted items (when encryption not available)

This commit is contained in:
azivner 2017-09-18 20:48:02 -04:00
parent 9e5fcb8be2
commit 66f4176fe8
2 changed files with 13 additions and 6 deletions

View file

@ -12,6 +12,11 @@ function getNodeByKey(noteId) {
function getFullName(noteId) { function getFullName(noteId) {
let note = getNodeByKey(noteId); let note = getNodeByKey(noteId);
if (note.data.is_clone || (note.data.encryption > 0 && !isEncryptionAvailable())) {
return null;
}
const path = []; const path = [];
while (note) { while (note) {

View file

@ -14,16 +14,18 @@ function error(str) {
error.fadeOut(10000); error.fadeOut(10000);
} }
function getAutocompleteItems(notes) { function getAutocompleteItems(noteIds) {
const autocompleteItems = []; const autocompleteItems = [];
for (const noteId of notes) { for (const noteId of noteIds) {
const fullName = getFullName(noteId); const fullName = getFullName(noteId);
autocompleteItems.push({ if (fullName !== null) {
value: fullName + " (" + noteId + ")", autocompleteItems.push({
label: fullName value: fullName + " (" + noteId + ")",
}); label: fullName
});
}
} }
return autocompleteItems; return autocompleteItems;