Skip to content

Commit c07bb62

Browse files
Guillermo Alejandro Gallardo Diezclaude
authored andcommitted
fix: owner_id was stored as string when recovered from settings on restart
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 3ac8e5f commit c07bb62

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/channels/wasm/setup.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -241,10 +241,11 @@ async fn register_channel(
241241
}
242242

243243
if let Some(ref resolved_owner_id) = owner_actor_id {
244-
config_updates.insert(
245-
"owner_id".to_string(),
246-
serde_json::Value::String(resolved_owner_id.clone()),
247-
);
244+
let owner_id_value = resolved_owner_id
245+
.parse::<i64>()
246+
.map(serde_json::Value::from)
247+
.unwrap_or_else(|_| serde_json::Value::String(resolved_owner_id.clone()));
248+
config_updates.insert("owner_id".to_string(), owner_id_value);
248249
}
249250

250251
if channel_name == TELEGRAM_CHANNEL_NAME
@@ -850,7 +851,7 @@ mod tests {
850851
let owner_id = runtime_config
851852
.get("owner_id")
852853
.expect("owner_id should be in config");
853-
assert_eq!(owner_id, &serde_json::json!("12345"));
854+
assert_eq!(owner_id, &serde_json::json!(12345));
854855
}
855856

856857
#[tokio::test]

0 commit comments

Comments
 (0)