From 318e0fa9a79ed02c8a64c5e3b0d0594a29f7d2c8 Mon Sep 17 00:00:00 2001 From: Chummy Date: Wed, 18 Feb 2026 00:08:36 +0800 Subject: [PATCH] fix(core): align CLI channel send call with SendMessage --- src/channels/mattermost.rs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/channels/mattermost.rs b/src/channels/mattermost.rs index 44e8819..132ca30 100644 --- a/src/channels/mattermost.rs +++ b/src/channels/mattermost.rs @@ -49,9 +49,7 @@ impl MattermostChannel { .await .ok()?; - resp.get("id") - .and_then(|u| u.as_str()) - .map(String::from) + resp.get("id").and_then(|u| u.as_str()).map(String::from) } } @@ -76,10 +74,10 @@ impl Channel for MattermostChannel { }); if let Some(root) = root_id { - body_map - .as_object_mut() - .unwrap() - .insert("root_id".to_string(), serde_json::Value::String(root.to_string())); + body_map.as_object_mut().unwrap().insert( + "root_id".to_string(), + serde_json::Value::String(root.to_string()), + ); } let resp = self @@ -152,7 +150,8 @@ impl Channel for MattermostChannel { post_list.sort_by_key(|p| p.get("create_at").and_then(|c| c.as_i64()).unwrap_or(0)); for post in post_list { - let msg = self.parse_mattermost_post(post, &bot_user_id, last_create_at, &channel_id); + let msg = + self.parse_mattermost_post(post, &bot_user_id, last_create_at, &channel_id); let create_at = post .get("create_at") .and_then(|c| c.as_i64()) @@ -207,7 +206,7 @@ impl MattermostChannel { let reply_target = if !root_id.is_empty() { format!("{}:{}", channel_id, root_id) } else { - // Or if it's a top-level message that WE want to start a thread on, + // Or if it's a top-level message that WE want to start a thread on, // the next reply will use THIS post's ID as root_id. // But for now, we follow Mattermost's 'reply' convention where // replying to a post uses its ID as root_id.