fix(XZH-21): align note history to notes.version, wire inbox into unified trash, migrate history on category delete

- NotesController: snapshot written under result version; history/{version} no longer falls back to current content; DBG removed
- V18: legacy_versioning flag so pre-upgrade history keeps its numbering
- NoteCategoriesController: migrate notes + history on category delete (includes trashed notes), snapshot at result version
- InboxController/TrashService/AdminToolsController: inbox items soft delete, restore, purge; recapture revives trashed item
- PlannerController batch tags scoped by kind; Dashboard taskCounts.due shares today-tasks filter
- Tests: 34 passing (3 new regression cases)
This commit is contained in:
HiFox Agent committed 2026-11-11 20:50:40 +08:00
1 parent 1bd637528d
commit a60ea8d262
10 files changed
+236 -58

No files matched your search

@@ -26,9 +26,11 @@ public class TrashService {
Map.entry("snippets", new Spec("planner_items", "代码片段", "title", false)),
Map.entry("rss", new Spec("rss_sources", "RSS 订阅", "title", false)),
Map.entry("prompts", new Spec("ai_prompts", "AI 提示词", "title", false)),
Map.entry("flows", new Spec("workspace_flows", "自动化工作流", "title", false)));
Map.entry("flows", new Spec("workspace_flows", "自动化工作流", "title", false)),
// 收集箱没有分类列:恢复时不补分类
Map.entry("inbox", new Spec("inbox_items", "收集项", "title", false)));
public static final List<String> KINDS = List.of("notes", "blogs", "bookmarks", "assets",
"tasks", "events", "snippets", "rss", "prompts", "flows");
"tasks", "events", "snippets", "rss", "prompts", "flows", "inbox");
private static final Map<String, String> CATEGORY_TABLES = Map.of(
"notes", "note_categories", "blogs", "blog_categories",
"assets", "asset_categories", "bookmarks", "bookmark_categories");
@@ -101,7 +103,9 @@ public class TrashService {
Object category = rows.getFirst().get("category");
if (spec.category() && category != null) ensureCategory(kind, (String) category);
notifications.notify("已恢复" + label(kind) + "「"
+ WorkspaceNotifications.clip((String) rows.getFirst().get("title"), 100) + "」");
+ WorkspaceNotifications.clip((String) rows.getFirst().get("title"), 100) + "」"
// 订阅删除时文章被同事务隐藏,恢复订阅不会把旧文章带回来,这里明确告知,避免误解
+ (Objects.equals(kind, "rss") ? ";删除时隐藏的历史文章不会恢复,下次刷新只拉取新文章" : ""));
}
@Transactional