Skip to content

Build your personal knowledge base with Trilium Notes

fix sharing of templates, #3562

zadam290f7e210117
diff --git a/src/public/app/entities/note_short.js b/src/public/app/entities/note_short.js
index dabdf396c9..d817b321ab 100644
--- a/src/public/app/entities/note_short.js
+++ b/src/public/app/entities/note_short.js
@@ -688,7 +688,7 @@ class NoteShort {
return promotedAttrs;
}
- hasAncestor(ancestorNoteId, visitedNoteIds = null) {
+ hasAncestor(ancestorNoteId, followTemplates = false, visitedNoteIds = null) {
if (this.noteId === ancestorNoteId) {
return true;
}
@@ -702,14 +702,16 @@ class NoteShort {
visitedNoteIds.add(this.noteId);
- for (const templateNote of this.getTemplateNotes()) {
- if (templateNote.hasAncestor(ancestorNoteId, visitedNoteIds)) {
- return true;
+ if (followTemplates) {
+ for (const templateNote of this.getTemplateNotes()) {
+ 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 7c3f4df0c0..78ac57a5a5 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;
}
}