From 7c60cdc51ed3429ad1b5b1089052b3ba7893bde2 Mon Sep 17 00:00:00 2001 From: Hocuri Date: Sun, 26 Apr 2026 10:00:47 +0200 Subject: [PATCH] Rename Reaction::from_str to new --- src/reaction.rs | 35 +++++++++++++++++------------------ src/receive_imf.rs | 2 +- 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/src/reaction.rs b/src/reaction.rs index 22ad5adf1..b459a132e 100644 --- a/src/reaction.rs +++ b/src/reaction.rs @@ -48,7 +48,7 @@ impl Reaction { /// reactions is not different from other kinds of spam attacks /// such as sending large numbers of large messages, and should be /// dealt with the same way, e.g. by blocking the user. - pub fn from_str(reaction: &str) -> Self { + pub fn new(reaction: &str) -> Self { let reaction: &str = reaction .split_ascii_whitespace() .next() @@ -207,7 +207,7 @@ pub async fn send_reaction(context: &Context, msg_id: MsgId, reaction: &str) -> let msg = Message::load_from_db(context, msg_id).await?; let chat_id = msg.chat_id; - let reaction = Reaction::from_str(reaction); + let reaction = Reaction::new(reaction); let mut reaction_msg = Message::new_text(reaction.as_str().to_string()); reaction_msg.set_reaction(); reaction_msg.in_reply_to = Some(msg.rfc724_mid); @@ -277,7 +277,7 @@ pub async fn get_msg_reactions(context: &Context, msg_id: MsgId) -> Result panic!("Unexpected event {event:?}."), } diff --git a/src/receive_imf.rs b/src/receive_imf.rs index b1c9151f2..f1a68e23c 100644 --- a/src/receive_imf.rs +++ b/src/receive_imf.rs @@ -2151,7 +2151,7 @@ async fn add_parts( chat_id, from_id, sort_timestamp, - Reaction::from_str(reaction_str.as_str()), + Reaction::new(reaction_str.as_str()), is_incoming_fresh, ) .await?;