Skip to content

Build your personal knowledge base with Trilium Notes

fix(client): a case where inheritance boolean is not correct

Elian Doran3bb97385c95f
diff --git a/apps/client/src/services/attributes.ts b/apps/client/src/services/attributes.ts
index 2f0a1202d8..0b156dcf3a 100644
--- a/apps/client/src/services/attributes.ts
+++ b/apps/client/src/services/attributes.ts
@@ -46,19 +46,19 @@ export async function setRelation(noteId: string, name: string, value: string =
export async function setBooleanWithInheritance(note: FNote, labelName: string, value: boolean) {
const actualValue = note.isLabelTruthy(labelName);
if (actualValue === value) return;
+ const hasInheritedValue = !note.hasOwnedLabel(labelName) && note.hasLabel(labelName);
- if (value) {
- if (note.getOwnedLabelValue(labelName) === "false") {
- // Remove the override so that the inherited true takes effect.
- removeOwnedLabelByName(note, labelName);
- } else {
+ if (hasInheritedValue) {
+ if (value) {
setLabel(note.noteId, labelName, "");
+ } else {
+ // Label is inherited - override to false.
+ setLabel(note.noteId, labelName, "false");
}
- } else if (note.hasOwnedLabel(labelName)) {
- removeOwnedLabelByName(note, labelName);
+ } else if (value) {
+ setLabel(note.noteId, labelName, "");
} else {
- // Label is inherited - override to false.
- setLabel(note.noteId, labelName, "false");
+ removeOwnedLabelByName(note, labelName);
}
}