From 81f5a31864cbaa84aa357a43ab32650999148c7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B5=85=E5=BF=B5?= Date: Fri, 7 Aug 2026 12:02:14 +0800 Subject: [PATCH] =?UTF-8?q?fix(calls):=20drawer=20callStatusLabel=20channe?= =?UTF-8?q?l-aware=20+=20isRoom=20=E6=8C=89=20=E6=98=AF/=E5=90=A6=20?= =?UTF-8?q?=E6=B8=B2=E6=9F=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit drawer 本地 callStatusLabel 此前为 phone-only 极性,与 list(Task 5 已 channel-aware) 在 voice/wa 的 call_status=2 上矛盾。改为按 channel 分支并补 1=接通;isRoom 加入 BOOLEAN_KEYS 以 是/否 渲染。 Co-Authored-By: Claude --- yunkes/src/utils/callFields.ts | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/yunkes/src/utils/callFields.ts b/yunkes/src/utils/callFields.ts index 2853d65..b8cbddc 100644 --- a/yunkes/src/utils/callFields.ts +++ b/yunkes/src/utils/callFields.ts @@ -95,18 +95,21 @@ const AUDIO_KEYS = new Set(['recordFile']) const TIMESTAMP_KEYS = new Set(['startCallTime', 'startTime', 'endTime']) /** Fields whose value is a boolean / 0|1 flag → render 是/否. */ -const BOOLEAN_KEYS = new Set(['isUpload']) +const BOOLEAN_KEYS = new Set(['isUpload', 'isRoom']) /** - * callStatus mapping used inside the drawer (per upstream call-log payload): - * 0 = 未接, 2 = 接通, other codes pass through so info isn't hidden. (The list - * column uses the format.ts helper which follows the 1=已接通/0=未接通 phone - * schema; the drawer surfaces the raw upstream value verbatim with this - * friendlier label.) + * callStatus mapping used inside the drawer. Polarity is channel-dependent + * (mirrors format.ts callStatusLabel, verified via smoke.db recording + * correlation): phone_call 0 = 未接 / 2 = 接通; voice_call / wa_voice_call + * 1 = 接通 / 2 = 未接. Value 2 flips meaning across channels, so it branches + * on channel. The drawer uses short 未接/接通 wording while the list column + * uses 未接通/已接通; both now agree on polarity per channel. Other codes pass + * through as raw text so info isn't hidden. */ -function callStatusLabel(v: unknown): string { +function callStatusLabel(v: unknown, channel?: string | null): string { if (v === 0 || v === '0') return '未接' - if (v === 2 || v === '2') return '接通' + if (v === 1 || v === '1') return '接通' + if (v === 2 || v === '2') return channel === 'phone_call' ? '接通' : '未接' return String(v) } @@ -215,7 +218,7 @@ export function toDisplayField(c: PhoneCall, camelKey: string): DisplayField { return { key: camelKey, label, value, render: 'time', text: formatTime(value) } } if (camelKey === 'callStatus') { - return { key: camelKey, label, value, render: 'status', text: callStatusLabel(value) } + return { key: camelKey, label, value, render: 'status', text: callStatusLabel(value, c.channel) } } if (camelKey === 'incomingCall') { return {