From 1cd7652a3475d121743e2c1b5e6ee9d7b1333382 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BB=9D=E5=B0=98?= <237809796@qq.com> Date: Wed, 17 Jun 2026 14:38:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D:=20taskStatusLabel=E6=97=A7?= =?UTF-8?q?=E6=80=81=E6=98=A0=E5=B0=84=E9=98=B2=E8=80=81DB=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/constants/project.ts | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/constants/project.ts b/src/constants/project.ts index e0359e1..b69aa62 100644 --- a/src/constants/project.ts +++ b/src/constants/project.ts @@ -83,12 +83,23 @@ export const TASK_STATUS_CLASS: Record = { cancelled: 'status-abandoned', } +// D-260616-01 删旧 5 态前的老 DB 数据兼容映射(老 DB 可能存 completed/review_ready/merged/abandoned) +// 新 DB 经 TaskStatus::is_valid 拦截不会有,但老 DB 未迁移清理时兜底显示而非 $t() 报错 +const LEGACY_STATUS_MAP: Record = { + completed: 'done', + review_ready: 'in_review', + merged: 'done', + abandoned: 'cancelled', +} + export function taskStatusLabel(status: string): string { - return TASK_STATUS_LABELS[status] ?? status + const mapped = LEGACY_STATUS_MAP[status] ?? status + return TASK_STATUS_LABELS[mapped] ?? 'tasks.status.todo' } export function taskStatusClass(status: string): string { - return TASK_STATUS_CLASS[status] ?? 'status-todo' + const mapped = LEGACY_STATUS_MAP[status] ?? status + return TASK_STATUS_CLASS[mapped] ?? 'status-todo' } // ── 任务优先级 ──