diff --git a/crates/matrix-sdk-ui/src/timeline/event_handler.rs b/crates/matrix-sdk-ui/src/timeline/event_handler.rs index e9c18081eac..fd5fad3565a 100644 --- a/crates/matrix-sdk-ui/src/timeline/event_handler.rs +++ b/crates/matrix-sdk-ui/src/timeline/event_handler.rs @@ -1097,19 +1097,10 @@ impl<'a, 'o> TimelineEventHandler<'a, 'o> { ); match &self.ctx.flow { - Flow::Local { txn_id, .. } => { + Flow::Local { .. } => { trace!("Adding new local timeline item"); - let removed_duplicated_timeline_item = Self::deduplicate_local_timeline_item( - &mut self.items, - &mut item, - None, - Some(&txn_id), - &self.meta, - &self.settings, - ); - let item = - Self::new_timeline_item(&mut self.meta, item, removed_duplicated_timeline_item); + let item = Self::new_timeline_item(&mut self.meta, item, None); self.items.push_back(item, None); } diff --git a/crates/matrix-sdk-ui/tests/integration/timeline/echo.rs b/crates/matrix-sdk-ui/tests/integration/timeline/echo.rs index f00ad135d05..2d715963ab4 100644 --- a/crates/matrix-sdk-ui/tests/integration/timeline/echo.rs +++ b/crates/matrix-sdk-ui/tests/integration/timeline/echo.rs @@ -121,16 +121,18 @@ async fn test_echo() { server.reset().await; // Local echo is replaced with the remote echo. + assert_next_matches!(timeline_stream, VectorDiff::Remove { index: 1 }); let remote_echo = - assert_next_matches!(timeline_stream, VectorDiff::Set { index: 1, value } => value); + assert_next_matches!(timeline_stream, VectorDiff::PushFront { value } => value); let item = remote_echo.as_event().unwrap(); assert!(item.is_own()); assert_eq!(item.timestamp(), MilliSecondsSinceUnixEpoch(uint!(152038280))); // The date divider is also replaced. let date_divider = - assert_next_matches!(timeline_stream, VectorDiff::Set { index: 0, value } => value); + assert_next_matches!(timeline_stream, VectorDiff::PushFront { value } => value); assert!(date_divider.is_date_divider()); + assert_next_matches!(timeline_stream, VectorDiff::Remove { index: 2 }); } #[async_test] diff --git a/crates/matrix-sdk-ui/tests/integration/timeline/queue.rs b/crates/matrix-sdk-ui/tests/integration/timeline/queue.rs index 32a11923dfc..d9d27689180 100644 --- a/crates/matrix-sdk-ui/tests/integration/timeline/queue.rs +++ b/crates/matrix-sdk-ui/tests/integration/timeline/queue.rs @@ -508,20 +508,21 @@ async fn test_no_duplicate_date_divider() { assert_eq!(value.event_id().unwrap(), "$PyHxV5mYzjetBUT3qZq7V95GOzxb02EP"); }); - // The second message is replaced -> [First DD Second] - assert_next_matches!(timeline_stream, VectorDiff::Set { index: 2, value } => { + // The second message is replaced -> [First Second DD] + assert_next_matches!(timeline_stream, VectorDiff::Remove { index: 2 }); + assert_next_matches!(timeline_stream, VectorDiff::Insert { index: 1, value } => { let value = value.as_event().unwrap(); assert_eq!(value.content().as_message().unwrap().body(), "Second."); assert_eq!(value.event_id().unwrap(), "$5E2kLK/Sg342bgBU9ceEIEPYpbFaqJpZ"); }); - // A new date divider is inserted -> [DD First DD Second] + // A new date divider is inserted -> [DD First Second DD] assert_next_matches!(timeline_stream, VectorDiff::PushFront { value } => { assert!(value.is_date_divider()); }); // The useless date divider is removed. -> [DD First Second] - assert_next_matches!(timeline_stream, VectorDiff::Remove { index: 2 }); + assert_next_matches!(timeline_stream, VectorDiff::Remove { index: 3 }); assert_pending!(timeline_stream); }