From 6e9fc70d139ddc491c9ea433de8d530e95e5ae7f Mon Sep 17 00:00:00 2001 From: Benjamin Bouvier Date: Mon, 21 Jul 2025 18:09:44 +0200 Subject: [PATCH] refactor(timeline): homogeneize naming of replied_to vs in_reply_to --- bindings/matrix-sdk-ffi/src/timeline/mod.rs | 4 ++-- crates/matrix-sdk-ui/src/timeline/futures.rs | 2 +- crates/matrix-sdk-ui/src/timeline/mod.rs | 16 ++++++++-------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/bindings/matrix-sdk-ffi/src/timeline/mod.rs b/bindings/matrix-sdk-ffi/src/timeline/mod.rs index 50a68d2d3..1e2e6c324 100644 --- a/bindings/matrix-sdk-ffi/src/timeline/mod.rs +++ b/bindings/matrix-sdk-ffi/src/timeline/mod.rs @@ -110,7 +110,7 @@ impl Timeline { let mime_str = mime_type.as_ref().ok_or(RoomError::InvalidAttachmentMimeType)?; let mime_type = mime_str.parse::().map_err(|_| RoomError::InvalidAttachmentMimeType)?; - let replied_to_event_id = params + let in_reply_to_event_id = params .in_reply_to .map(EventId::parse) .transpose() @@ -127,7 +127,7 @@ impl Timeline { caption: params.caption, formatted_caption, mentions: params.mentions.map(Into::into), - replied_to: replied_to_event_id, + in_reply_to: in_reply_to_event_id, ..Default::default() }; diff --git a/crates/matrix-sdk-ui/src/timeline/futures.rs b/crates/matrix-sdk-ui/src/timeline/futures.rs index 05cffc736..1cb47aac9 100644 --- a/crates/matrix-sdk-ui/src/timeline/futures.rs +++ b/crates/matrix-sdk-ui/src/timeline/futures.rs @@ -73,7 +73,7 @@ impl<'a> IntoFuture for SendAttachment<'a> { let fut = async move { let (data, filename) = source.try_into_bytes_and_filename()?; - let reply = timeline.infer_reply(config.replied_to).await; + let reply = timeline.infer_reply(config.in_reply_to).await; let sdk_config = matrix_sdk::attachment::AttachmentConfig { txn_id: config.txn_id, info: config.info, diff --git a/crates/matrix-sdk-ui/src/timeline/mod.rs b/crates/matrix-sdk-ui/src/timeline/mod.rs index 6f9f5f344..839f4811a 100644 --- a/crates/matrix-sdk-ui/src/timeline/mod.rs +++ b/crates/matrix-sdk-ui/src/timeline/mod.rs @@ -172,7 +172,7 @@ pub enum DateDividerMode { /// Configuration for sending an attachment. /// /// Like [`matrix_sdk::attachment::AttachmentConfig`], but instead of the -/// `reply` field, there's only a `replied_to` event id; it's the timeline +/// `reply` field, there's only a `in_reply_to` event id; it's the timeline /// deciding to fill the rest of the reply parameters. #[derive(Debug, Default)] pub struct AttachmentConfig { @@ -182,7 +182,7 @@ pub struct AttachmentConfig { pub caption: Option, pub formatted_caption: Option, pub mentions: Option, - pub replied_to: Option, + pub in_reply_to: Option, } impl Timeline { @@ -346,10 +346,10 @@ impl Timeline { pub async fn send_reply( &self, content: RoomMessageEventContentWithoutRelation, - replied_to: OwnedEventId, + in_reply_to: OwnedEventId, ) -> Result<(), Error> { let reply = self - .infer_reply(Some(replied_to)) + .infer_reply(Some(in_reply_to)) .await .expect("the reply will always be set because we provided a replied-to event id"); let content = self.room().make_reply_event(content, reply).await?; @@ -357,19 +357,19 @@ impl Timeline { Ok(()) } - /// Given a message or media to send, and an optional `replied_to` event, + /// Given a message or media to send, and an optional `in_reply_to` event, /// automatically fills the [`Reply`] information based on the current /// timeline focus. - pub(crate) async fn infer_reply(&self, replied_to: Option) -> Option { + pub(crate) async fn infer_reply(&self, in_reply_to: Option) -> Option { // If there's a replied-to event id, the reply is pretty straightforward, and we // should only infer the `EnforceThread` based on the current focus. - if let Some(replied_to) = replied_to { + if let Some(in_reply_to) = in_reply_to { let enforce_thread = if self.controller.is_threaded() { EnforceThread::Threaded(ReplyWithinThread::Yes) } else { EnforceThread::MaybeThreaded }; - return Some(Reply { event_id: replied_to, enforce_thread }); + return Some(Reply { event_id: in_reply_to, enforce_thread }); } let thread_root = self.controller.thread_root()?;