mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
small fixes
This commit is contained in:
parent
d905335935
commit
23ebe360a6
@ -624,6 +624,17 @@ export default class NoteTreeWidget extends TabAwareWidget {
|
|||||||
updateNode(node) {
|
updateNode(node) {
|
||||||
const note = treeCache.getNoteFromCache(node.data.noteId);
|
const note = treeCache.getNoteFromCache(node.data.noteId);
|
||||||
const branch = treeCache.getBranch(node.data.branchId);
|
const branch = treeCache.getBranch(node.data.branchId);
|
||||||
|
|
||||||
|
if (!note) {
|
||||||
|
console.log(`Node update not possible because note ${node.data.noteId} was not found.`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!branch) {
|
||||||
|
console.log(`Node update not possible because branch ${node.data.branchId} was not found.`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const title = (branch.prefix ? (branch.prefix + " - ") : "") + note.title;
|
const title = (branch.prefix ? (branch.prefix + " - ") : "") + note.title;
|
||||||
|
|
||||||
node.data.isProtected = note.isProtected;
|
node.data.isProtected = note.isProtected;
|
||||||
|
@ -148,19 +148,15 @@ eventService.subscribe(eventService.ENTITY_DELETED, ({ entityName, entity }) =>
|
|||||||
processInverseRelations(entityName, entity, (definition, note, targetNote) => {
|
processInverseRelations(entityName, entity, (definition, note, targetNote) => {
|
||||||
// if one inverse attribute is deleted then the other should be deleted as well
|
// if one inverse attribute is deleted then the other should be deleted as well
|
||||||
const relations = targetNote.getOwnedRelations(definition.inverseRelation);
|
const relations = targetNote.getOwnedRelations(definition.inverseRelation);
|
||||||
let deletedSomething = false;
|
|
||||||
|
|
||||||
for (const relation of relations) {
|
for (const relation of relations) {
|
||||||
if (relation.value === note.noteId) {
|
if (relation.value === note.noteId) {
|
||||||
|
note.invalidateAttributeCache();
|
||||||
|
targetNote.invalidateAttributeCache();
|
||||||
|
|
||||||
relation.isDeleted = true;
|
relation.isDeleted = true;
|
||||||
relation.save();
|
relation.save();
|
||||||
|
|
||||||
deletedSomething = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (deletedSomething) {
|
|
||||||
targetNote.invalidateAttributeCache();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user