Skip to content

Build your personal knowledge base with Trilium Notes

fix sharing of templates, #3562

zadam460b5fb3a489
diff --git a/src/public/app/entities/fnote.js b/src/public/app/entities/fnote.js
index 0dffed6d92..950e318a58 100644
--- a/src/public/app/entities/fnote.js
+++ b/src/public/app/entities/fnote.js
@@ -707,7 +707,7 @@ class FNote {
return promotedAttrs;
}
- hasAncestor(ancestorNoteId, visitedNoteIds = null) {
+ hasAncestor(ancestorNoteId, followTemplates = false, visitedNoteIds = null) {
if (this.noteId === ancestorNoteId) {
return true;
}
@@ -721,14 +721,16 @@ class FNote {
visitedNoteIds.add(this.noteId);
- for (const templateNote of this.getNotesToInheritAttributesFrom()) {
- if (templateNote.hasAncestor(ancestorNoteId, visitedNoteIds)) {
- return true;
+ if (followTemplates) {
+ for (const templateNote of this.getNotesToInheritAttributesFrom()) {
+ if (templateNote.hasAncestor(ancestorNoteId, followTemplates, visitedNoteIds)) {
+ return true;
+ }
}
}
for (const parentNote of this.getParentNotes()) {
- if (parentNote.hasAncestor(ancestorNoteId, visitedNoteIds)) {
+ if (parentNote.hasAncestor(ancestorNoteId, followTemplates, visitedNoteIds)) {
return true;
}
}
diff --git a/src/public/app/services/attributes.js b/src/public/app/services/attributes.js
index 97847855ee..7267d9bb8e 100644
--- a/src/public/app/services/attributes.js
+++ b/src/public/app/services/attributes.js
@@ -50,7 +50,7 @@ function isAffecting(attrRow, affectedNote) {
if (this.isInheritable) {
for (const owningNote of owningNotes) {
- if (owningNote.hasAncestor(attrNote.noteId)) {
+ if (owningNote.hasAncestor(attrNote.noteId, true)) {
return true;
}
}