Skip to content

AI-native knowledge base & Evernote/Obsidian alternative with instant sync & native MCP. Free on Cloudflare or self-hosted via Docker.

Restore default inbox notebook

tianma35209f61946a
diff --git a/apps/api/src/index.ts b/apps/api/src/index.ts
index 1a57adc9..b9ff1044 100644
--- a/apps/api/src/index.ts
+++ b/apps/api/src/index.ts
@@ -616,7 +616,7 @@ app.delete("/api/v1/notebooks/:id", async (c) => {
return notFound(c, "Notebook not found");
}
- if (id === "nb_inbox") {
+ if (id === "nb_inbox" || current.slug === "inbox") {
return badRequest(c, "等待分类不能删除。");
}
diff --git a/apps/web/src/components/WorkspaceApp.tsx b/apps/web/src/components/WorkspaceApp.tsx
index 965263ba..1c0378d6 100644
--- a/apps/web/src/components/WorkspaceApp.tsx
+++ b/apps/web/src/components/WorkspaceApp.tsx
@@ -604,7 +604,9 @@ export const WorkspaceApp = ({
const notebooks = notebooksQuery.data?.notebooks ?? [];
const defaultMemoNotebookId =
- notebooks.find((notebook) => notebook.slug === "inbox")?.id ?? selectedNotebookId ?? notebooks[0]?.id ?? null;
+ notebooks.find(
+ (notebook) => notebook.id === "nb_inbox" || notebook.slug === "inbox" || notebook.name === "等待分类"
+ )?.id ?? null;
const canCreateMemo = Boolean(defaultMemoNotebookId && memoView !== "trash");
const memoSelectionModeActive = memoSelectionMode || selectedMemoIds.size > 0;
const mobileSearchActive = mobileBottomNavActive === "search";
diff --git a/migrations/0010_restore_default_inbox_notebook.sql b/migrations/0010_restore_default_inbox_notebook.sql
new file mode 100644
index 00000000..267a64cb
--- /dev/null
+++ b/migrations/0010_restore_default_inbox_notebook.sql
@@ -0,0 +1,26 @@
+PRAGMA foreign_keys = ON;
+
+UPDATE notebooks
+SET
+ parent_id = NULL,
+ name = '等待分类',
+ slug = 'inbox',
+ icon = 'notebook',
+ color = '#0f766e',
+ sort_order = 10,
+ is_deleted = 0,
+ deleted_at = NULL,
+ updated_at = strftime('%Y-%m-%dT%H:%M:%fZ', 'now')
+WHERE id = 'nb_inbox'
+ OR slug = 'inbox'
+ OR name = '等待分类';
+
+INSERT INTO notebooks (id, parent_id, name, slug, icon, color, sort_order)
+SELECT 'nb_inbox', NULL, '等待分类', 'inbox', 'notebook', '#0f766e', 10
+WHERE NOT EXISTS (
+ SELECT 1
+ FROM notebooks
+ WHERE id = 'nb_inbox'
+ OR slug = 'inbox'
+ OR name = '等待分类'
+);