Skip to content

πŸ“š The open-source, offline-first Notion, Obsidian & Confluence alternative. Advanced Markdown, multi-tenant teams, OIDC/SSO, and local S3 backups. Deploy in one command.

fix: create category when shared workspace selected

Smaug6739b8859d5bddc5
diff --git a/frontend/app/components/Node/Modals/CreateCategory.vue b/frontend/app/components/Node/Modals/CreateCategory.vue
index 5c37ee61..ad70fe55 100644
--- a/frontend/app/components/Node/Modals/CreateCategory.vue
+++ b/frontend/app/components/Node/Modals/CreateCategory.vue
@@ -37,11 +37,22 @@ const sidebar = useSidebar();
const categoriesItem = nodesTree.categoriesTree;
+function getDefaultParentId() {
+ const activeId = sidebar.active_id.value;
+ if (activeId) {
+ const activeNode = nodesTree.getAncestorCategory(activeId);
+ if (activeNode) return activeNode.id;
+ }
+ const workspaceId = sidebar.workspaceId.value;
+ if (workspaceId == 'shared') return undefined;
+ return workspaceId;
+}
+
const category = ref<Partial<Node>>({
name: '',
role: props.role,
accessibility: 1,
- parent_id: nodesTree.getAncestorCategory(sidebar.active_id.value)?.id || sidebar.workspaceId.value,
+ parent_id: getDefaultParentId(),
});
const createCategory = () => {