Elffuss BraidHub

kikocis/utopia public

Activity names the engine instead of a removed user (#230)

Closes #224

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Changeset6c745dac59c4300fca2ded5bd2f8b1be2000853027f1410d51766bfed4f780de
AuthorWaylandYang <145302500+WaylandYang@users.noreply.github.com> · 2026-09-03 05:47 +08:00
CommitterGitHub <noreply@github.com> · 2026-09-03 05:47 +08:00
Parentsdaaf32c13c87

Browse the files at this changeset

6 files changed

modified crates/utopia-core/src/models.rs +3 −0
@@ -194,6 +194,9 @@
194194 pub target_kind: String,
195195 pub target_id: Option<Uuid>,
196196 pub detail: serde_json::Value,
197+ /// NULL = 引擎自动(裁决器合并、一致性检查、推理物化……)。界面靠它把
198+ /// 「没有人」和「人已被移除」分开:后者 actor_id 还在,只是查不到显示名
199+ pub actor_id: Option<Uuid>,
197200 pub actor_name: Option<String>,
198201 pub created_at: DateTime<Utc>,
199202 }
modified crates/utopia-store/src/audit.rs +2 −2
@@ -101,7 +101,7 @@
101101 OR e.action LIKE 'conflict.%' OR e.action LIKE 'merge.%')";
102102 let rows: Vec<AuditEventView> = sqlx::query_as(&format!(
103103 "SELECT e.id, e.action, e.target_kind, e.target_id, e.detail,
104- u.display_name AS actor_name, e.created_at
104+ e.actor_id, u.display_name AS actor_name, e.created_at
105105 FROM audit_events e LEFT JOIN users u ON u.id = e.actor_id
106106 WHERE {COND} ORDER BY e.created_at DESC LIMIT $2 OFFSET $3"
107107 ))
@@ -152,7 +152,7 @@
152152
153153 let rows: Vec<AuditEventView> = sqlx::query_as(&format!(
154154 "SELECT e.id, e.action, e.target_kind, e.target_id, e.detail,
155- u.display_name AS actor_name, e.created_at
155+ e.actor_id, u.display_name AS actor_name, e.created_at
156156 FROM audit_events e LEFT JOIN users u ON u.id = e.actor_id
157157 {WHERE}
158158 ORDER BY e.created_at DESC LIMIT $6 OFFSET $7"
modified web/src/api.ts +2 −0
@@ -132,6 +132,8 @@
132132 target_kind: string;
133133 target_id: string | null;
134134 detail: Record<string, unknown>;
135+ /** null = 引擎自动(裁决器、一致性检查、推理);有 id 没名字 = 账号已移除 */
136+ actor_id: string | null;
135137 actor_name: string | null;
136138 created_at: string;
137139 }
modified web/src/i18n/en.ts +3 −0
@@ -1448,6 +1448,9 @@
14481448 auditTotal: (n: number) => `${n} events`,
14491449 activityEmpty: "Nothing recorded yet.",
14501450 deletedUser: "a removed user",
1451+ // actor_id 为空的两种引擎动作:审阅队列里的自动裁决,和其余后台工作
1452+ adjudicator: "AI adjudicator",
1453+ engine: "the engine",
14511454 auditActions: {
14521455 "entity_type.created": "created entity type",
14531456 "entity_type.updated": "updated entity type",
modified web/src/i18n/zh.ts +2 −0
@@ -1306,6 +1306,8 @@
13061306 auditTotal: (n: number) => `共 ${n} 条`,
13071307 activityEmpty: "还没有记录。",
13081308 deletedUser: "一位已移除的用户",
1309+ adjudicator: "AI 裁决器",
1310+ engine: "引擎",
13091311 auditActions: {
13101312 "entity_type.created": "创建了实体类型",
13111313 "entity_type.updated": "更新了实体类型",
modified web/src/pages/KbSettings.tsx +6 −1
@@ -492,7 +492,12 @@
492492 </span>
493493 <span className="min-w-0 truncate">
494494 <span className="text-neutral-200">
495- {e.actor_name ?? S.kbset.deletedUser}
495+ {e.actor_name ??
496+ (e.actor_id
497+ ? S.kbset.deletedUser
498+ : e.action.startsWith("review.")
499+ ? S.kbset.adjudicator
500+ : S.kbset.engine)}
496501 </span>{" "}
497502 <span className="text-neutral-500">
498503 {S.kbset.auditActions[e.action] ?? e.action}