Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
new "disable_inclusion" attribute
azivner1c6fc9029f41
diff --git a/src/entities/note.js b/src/entities/note.jsindex f0a18a00e0..c0f758e025 100644--- a/src/entities/note.js+++ b/src/entities/note.js@@ -47,6 +47,13 @@ class Note extends Entity {return map;}+ async hasAttribute(name) {+ const map = await this.getAttributeMap();++ return map.hasOwnProperty(name);+ }++ // WARNING: this doesn't take into account the possibility to have multi-valued attributes!async getAttribute(name) {return this.repository.getEntity("SELECT * FROM attributes WHERE noteId = ? AND name = ?", [this.noteId, name]);}diff --git a/src/services/attributes.js b/src/services/attributes.jsindex fc7269ece8..8c8cc8e66c 100644--- a/src/services/attributes.js+++ b/src/services/attributes.js@@ -12,7 +12,8 @@ const BUILTIN_ATTRIBUTES = ['hide_in_autocomplete','exclude_from_export','run',- 'manual_transaction_handling'+ 'manual_transaction_handling',+ 'disable_inclusion'];async function getNoteAttributeMap(noteId) {diff --git a/src/services/scheduler.js b/src/services/scheduler.jsindex b256615eb8..0485013071 100644--- a/src/services/scheduler.js+++ b/src/services/scheduler.js@@ -19,7 +19,7 @@ async function runNotesWithAttribute(runAttrValue) {}}-setTimeout(() => runNotesWithAttribute('backend_startup'), 1 * 1000);+setTimeout(() => runNotesWithAttribute('backend_startup'), 10 * 1000);setInterval(() => runNotesWithAttribute('hourly'), 3600 * 1000);diff --git a/src/services/script.js b/src/services/script.jsindex 78261d8687..415c9454b0 100644--- a/src/services/script.js+++ b/src/services/script.js@@ -61,6 +61,10 @@ async function getScriptBundle(note, includedNoteIds = []) {return;}+ if (await note.hasAttribute('disable_inclusion')) {+ return;+ }+const bundle = {note: note,script: '',