fix(calls): drawer callStatusLabel channel-aware + isRoom 按 是/否 渲染

drawer 本地 callStatusLabel 此前为 phone-only 极性,与 list(Task 5 已 channel-aware)
在 voice/wa 的 call_status=2 上矛盾。改为按 channel 分支并补 1=接通;isRoom 加入
BOOLEAN_KEYS 以 是/否 渲染。

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
浅念
2026-08-07 12:02:14 +08:00
parent 7a5bb9927e
commit 81f5a31864
+12 -9
View File
@@ -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 {