Skip to content

Build your personal knowledge base with Trilium Notes

feat(board/relation): group by relation

Elian Doran47f7968dc402
diff --git a/apps/client/src/entities/fnote.ts b/apps/client/src/entities/fnote.ts
index 230c4783c5..425742ee3b 100644
--- a/apps/client/src/entities/fnote.ts
+++ b/apps/client/src/entities/fnote.ts
@@ -804,6 +804,16 @@ export default class FNote {
return this.getAttributeValue(LABEL, name);
}
+ getLabelOrRelation(nameWithPrefix: string) {
+ if (nameWithPrefix.startsWith("#")) {
+ return this.getLabelValue(nameWithPrefix.substring(1));
+ } else if (nameWithPrefix.startsWith("~")) {
+ return this.getRelationValue(nameWithPrefix.substring(1));
+ } else {
+ return this.getLabelValue(nameWithPrefix);
+ }
+ }
+
/**
* @param name - relation name
* @returns relation value if relation exists, null otherwise
diff --git a/apps/client/src/widgets/collections/board/data.ts b/apps/client/src/widgets/collections/board/data.ts
index f283e2dc78..a37487ec90 100644
--- a/apps/client/src/widgets/collections/board/data.ts
+++ b/apps/client/src/widgets/collections/board/data.ts
@@ -57,7 +57,8 @@ export async function getBoardData(parentNote: FNote, groupByColumn: string, per
return {
byColumn,
- newPersistedData
+ newPersistedData,
+ isInRelationMode: groupByColumn.startsWith("~")
};
}
@@ -70,7 +71,7 @@ async function recursiveGroupBy(branches: FBranch[], byColumn: ColumnMap, groupB
await recursiveGroupBy(note.getChildBranches(), byColumn, groupByColumn, includeArchived, seenNoteIds);
}
- const group = note.getLabelValue(groupByColumn);
+ const group = note.getLabelOrRelation(groupByColumn);
if (!group || seenNoteIds.has(note.noteId)) {
continue;
}