From 07b060c4115e146adbcf065dab12346ed7aa5abb Mon Sep 17 00:00:00 2001 From: ksoonks Date: Sat, 28 Mar 2026 12:05:33 +0100 Subject: [PATCH] Fix: preserve secret fields when saving channel config --- .../channels/channel-config-page.tsx | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/web/frontend/src/components/channels/channel-config-page.tsx b/web/frontend/src/components/channels/channel-config-page.tsx index 6af821ac9..046250527 100644 --- a/web/frontend/src/components/channels/channel-config-page.tsx +++ b/web/frontend/src/components/channels/channel-config-page.tsx @@ -91,18 +91,18 @@ function buildSavePayload( ): ChannelConfig { const payload: ChannelConfig = { enabled } - for (const [key, value] of Object.entries(editConfig)) { - if (key.startsWith("_")) continue - if (key === "enabled") continue + for (const [k, v] of Object.entries(editConfig)) { + if (k === "enabled" || k.startsWith("_")) continue; + payload[k] = v; + } - if (key in SECRET_FIELD_MAP) { - const editKey = SECRET_FIELD_MAP[key] - const incoming = asString(editConfig[editKey]) - payload[key] = incoming !== "" ? incoming : value - continue + for (const [secret, editKey] of Object.entries(SECRET_FIELD_MAP)) { + const incoming = asString(editConfig[editKey]); + if (incoming !== "") { + payload[secret] = incoming; + } else if (secret in editConfig) { + payload[secret] = editConfig[secret]; } - - payload[key] = value } if (channel.name === "whatsapp_native") {