mirror of
https://github.com/zadam/trilium.git
synced 2026-02-27 09:03:36 +01:00
fix(hidden_subtree): attribute of wrong type (relation vs label) causing issues
This commit is contained in:
parent
8d233e66e1
commit
7ec718218e
@ -192,5 +192,16 @@ describe("Hidden Subtree", () => {
|
||||
llmNote = becca.getNote(noteId);
|
||||
expect(llmNote).toBeFalsy();
|
||||
});
|
||||
|
||||
it("fixes attribute of wrong type", () => {
|
||||
const template = becca.getNoteOrThrow("_template_table");
|
||||
cls.init(() => {
|
||||
template.setAttribute("relation", "template", "root");
|
||||
hiddenSubtreeService.checkHiddenSubtree();
|
||||
});
|
||||
const attr = template.getAttributes().find(a => a.name === "template");
|
||||
expect(attr).toBeDefined();
|
||||
expect(attr?.type).toBe("label");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@ -467,8 +467,10 @@ function checkHiddenSubtreeRecursively(parentNoteId: string, item: HiddenSubtree
|
||||
}
|
||||
|
||||
// Ensure value is consistent.
|
||||
if (attribute.value !== attrDef.value) {
|
||||
note.setAttributeValueById(attribute.attributeId, attrDef.value);
|
||||
if (attribute.value !== attrDef.value || attribute.type !== attrDef.type) {
|
||||
attribute.type = attrDef.type;
|
||||
attribute.value = attrDef.value ?? "";
|
||||
attribute.save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user