From 27165e9927104901b5f737a0baac3427361db7a3 Mon Sep 17 00:00:00 2001 From: Bennet Bo Fenner <53836821+bennetbo@users.noreply.github.com> Date: Thu, 4 Apr 2024 15:12:35 +0200 Subject: [PATCH] channel chat: Set first loaded message ID when sending a message (#10034) Discovered while looking into #10024. When clicking on a reply message text, the original message should be highlighted accordingly. However this would not work when the channel was just created and the user is the only one that sent messages. Release Notes: - Fixed highlighting of messages when clicking on the reply message text in the chat and there were no other messages from other users --- crates/channel/src/channel_chat.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/crates/channel/src/channel_chat.rs b/crates/channel/src/channel_chat.rs index 9085cebfa366cda7c8721d823a991aece9dc816a..e662e2db8e204ed799f750e29c68cbfd103e785a 100644 --- a/crates/channel/src/channel_chat.rs +++ b/crates/channel/src/channel_chat.rs @@ -222,6 +222,9 @@ impl ChannelChat { let message = ChannelMessage::from_proto(response, &user_store, &mut cx).await?; this.update(&mut cx, |this, cx| { this.insert_messages(SumTree::from_item(message, &()), cx); + if this.first_loaded_message_id.is_none() { + this.first_loaded_message_id = Some(id); + } })?; Ok(id) }))