mirror of
https://github.com/zadam/trilium.git
synced 2025-11-03 03:46:37 +01:00
subtree duplication with becca
This commit is contained in:
@@ -93,14 +93,22 @@ class Note extends AbstractEntity {
|
||||
return this.parentBranches;
|
||||
}
|
||||
|
||||
getBranches() {
|
||||
return this.parentBranches;
|
||||
}
|
||||
|
||||
getParentNotes() {
|
||||
return this.parents;
|
||||
}
|
||||
|
||||
getChildrenNotes() {
|
||||
getChildNotes() {
|
||||
return this.children;
|
||||
}
|
||||
|
||||
getChildBranches() {
|
||||
return this.children.map(childNote => this.becca.getBranch(childNote.noteId, this.noteId));
|
||||
}
|
||||
|
||||
/*
|
||||
* Note content has quite special handling - it's not a separate entity, but a lazily loaded
|
||||
* part of Note entity with it's own sync. Reasons behind this hybrid design has been:
|
||||
@@ -525,6 +533,26 @@ class Note extends AbstractEntity {
|
||||
return this.getOwnedAttributes(RELATION, name);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} [type] - (optional) attribute type to filter
|
||||
* @param {string} [name] - (optional) attribute name to filter
|
||||
* @returns {Attribute[]} note's "owned" attributes - excluding inherited ones
|
||||
*/
|
||||
getOwnedAttributes(type, name) {
|
||||
if (type && name) {
|
||||
return this.ownedAttributes.filter(attr => attr.type === type && attr.name === name);
|
||||
}
|
||||
else if (type) {
|
||||
return this.ownedAttributes.filter(attr => attr.type === type);
|
||||
}
|
||||
else if (name) {
|
||||
return this.ownedAttributes.filter(attr => attr.name === name);
|
||||
}
|
||||
else {
|
||||
return this.ownedAttributes.slice();
|
||||
}
|
||||
}
|
||||
|
||||
get isArchived() {
|
||||
return this.hasAttribute('label', 'archived');
|
||||
}
|
||||
@@ -672,6 +700,10 @@ class Note extends AbstractEntity {
|
||||
return this.subtreeNotes.map(note => note.noteId);
|
||||
}
|
||||
|
||||
getDescendantNoteIds() {
|
||||
return this.subtreeNoteIds;
|
||||
}
|
||||
|
||||
get parentCount() {
|
||||
return this.parents.length;
|
||||
}
|
||||
@@ -775,10 +807,6 @@ class Note extends AbstractEntity {
|
||||
return minDistance;
|
||||
}
|
||||
|
||||
getChildBranches() {
|
||||
return this.children.map(childNote => this.becca.getBranch(childNote.noteId, this.noteId));
|
||||
}
|
||||
|
||||
decrypt() {
|
||||
if (this.isProtected && !this.isDecrypted && protectedSessionService.isProtectedSessionAvailable()) {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user