Skip to content

Build your personal knowledge base with Trilium Notes

new "disable_inclusion" attribute

azivner1c6fc9029f41
diff --git a/src/entities/note.js b/src/entities/note.js
index 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.js
index 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.js
index 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.js
index 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: '',