Skip to content

Commit 6e9fc70

Browse files
committed
refactor(timeline): homogeneize naming of replied_to vs in_reply_to
1 parent e2148e4 commit 6e9fc70

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

bindings/matrix-sdk-ffi/src/timeline/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ impl Timeline {
110110
let mime_str = mime_type.as_ref().ok_or(RoomError::InvalidAttachmentMimeType)?;
111111
let mime_type =
112112
mime_str.parse::<Mime>().map_err(|_| RoomError::InvalidAttachmentMimeType)?;
113-
let replied_to_event_id = params
113+
let in_reply_to_event_id = params
114114
.in_reply_to
115115
.map(EventId::parse)
116116
.transpose()
@@ -127,7 +127,7 @@ impl Timeline {
127127
caption: params.caption,
128128
formatted_caption,
129129
mentions: params.mentions.map(Into::into),
130-
replied_to: replied_to_event_id,
130+
in_reply_to: in_reply_to_event_id,
131131
..Default::default()
132132
};
133133

crates/matrix-sdk-ui/src/timeline/futures.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ impl<'a> IntoFuture for SendAttachment<'a> {
7373
let fut = async move {
7474
let (data, filename) = source.try_into_bytes_and_filename()?;
7575

76-
let reply = timeline.infer_reply(config.replied_to).await;
76+
let reply = timeline.infer_reply(config.in_reply_to).await;
7777
let sdk_config = matrix_sdk::attachment::AttachmentConfig {
7878
txn_id: config.txn_id,
7979
info: config.info,

crates/matrix-sdk-ui/src/timeline/mod.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ pub enum DateDividerMode {
172172
/// Configuration for sending an attachment.
173173
///
174174
/// Like [`matrix_sdk::attachment::AttachmentConfig`], but instead of the
175-
/// `reply` field, there's only a `replied_to` event id; it's the timeline
175+
/// `reply` field, there's only a `in_reply_to` event id; it's the timeline
176176
/// deciding to fill the rest of the reply parameters.
177177
#[derive(Debug, Default)]
178178
pub struct AttachmentConfig {
@@ -182,7 +182,7 @@ pub struct AttachmentConfig {
182182
pub caption: Option<String>,
183183
pub formatted_caption: Option<FormattedBody>,
184184
pub mentions: Option<Mentions>,
185-
pub replied_to: Option<OwnedEventId>,
185+
pub in_reply_to: Option<OwnedEventId>,
186186
}
187187

188188
impl Timeline {
@@ -346,30 +346,30 @@ impl Timeline {
346346
pub async fn send_reply(
347347
&self,
348348
content: RoomMessageEventContentWithoutRelation,
349-
replied_to: OwnedEventId,
349+
in_reply_to: OwnedEventId,
350350
) -> Result<(), Error> {
351351
let reply = self
352-
.infer_reply(Some(replied_to))
352+
.infer_reply(Some(in_reply_to))
353353
.await
354354
.expect("the reply will always be set because we provided a replied-to event id");
355355
let content = self.room().make_reply_event(content, reply).await?;
356356
self.send(content.into()).await?;
357357
Ok(())
358358
}
359359

360-
/// Given a message or media to send, and an optional `replied_to` event,
360+
/// Given a message or media to send, and an optional `in_reply_to` event,
361361
/// automatically fills the [`Reply`] information based on the current
362362
/// timeline focus.
363-
pub(crate) async fn infer_reply(&self, replied_to: Option<OwnedEventId>) -> Option<Reply> {
363+
pub(crate) async fn infer_reply(&self, in_reply_to: Option<OwnedEventId>) -> Option<Reply> {
364364
// If there's a replied-to event id, the reply is pretty straightforward, and we
365365
// should only infer the `EnforceThread` based on the current focus.
366-
if let Some(replied_to) = replied_to {
366+
if let Some(in_reply_to) = in_reply_to {
367367
let enforce_thread = if self.controller.is_threaded() {
368368
EnforceThread::Threaded(ReplyWithinThread::Yes)
369369
} else {
370370
EnforceThread::MaybeThreaded
371371
};
372-
return Some(Reply { event_id: replied_to, enforce_thread });
372+
return Some(Reply { event_id: in_reply_to, enforce_thread });
373373
}
374374

375375
let thread_root = self.controller.thread_root()?;

0 commit comments

Comments
 (0)