|
|
|
|
@ -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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|