Skip to content

Commit

Permalink
!fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
Hywan committed Jun 17, 2024
1 parent d07a56f commit 59251f0
Showing 1 changed file with 1 addition and 35 deletions.
36 changes: 1 addition & 35 deletions crates/matrix-sdk-ui/src/timeline/event_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,7 @@ use super::{
EventTimelineItem, InReplyToDetails, Message, OtherState, ReactionGroup, ReactionSenderData,
Sticker, TimelineDetails, TimelineItem, TimelineItemContent,
};
use crate::{
events::SyncTimelineEventWithoutContent, timeline::inner::EventMeta, DEFAULT_SANITIZER_MODE,
};
use crate::{events::SyncTimelineEventWithoutContent, DEFAULT_SANITIZER_MODE};

/// When adding an event, useful information related to the source of the event.
#[derive(Clone)]
Expand Down Expand Up @@ -1032,38 +1030,6 @@ impl<'a, 'o> TimelineEventHandler<'a, 'o> {
// In more complex cases, remove the item before re-adding the item.
trace!("Removing local echo or duplicate timeline item");

dbg!(idx);
dbg!(&self.meta.all_events);

/*
// OK so we have a duplicated timeline item for sure. We must also remove
// the duplicated event in `self.meta.all_events`!
// However, we must be careful here. The timeline item can be duplicated
// without the event being duplicated: it happens when the timeline item is
// virtual for example. So we need to check there is an actual duplicated
// event, and record the position of the first event
let mut first_duplicated_event_index = None;
let mut number_of_duplications: usize = 0;
for (index, EventMeta { event_id: evt_id, .. }) in
self.meta.all_events.iter().enumerate()
{
if evt_id == event_id {
if first_duplicated_event_index.is_none() {
first_duplicated_event_index = Some(index);
}
number_of_duplications += 1;
}
}
if number_of_duplications > 1 {
if let Some(event_index) = first_duplicated_event_index {
self.meta.all_events.remove(event_index);
}
}
*/

// Shift all timeline item indices to the left after `idx`!
for event_meta in &mut self.meta.all_events {
if let Some(index) = event_meta.timeline_item_index.as_mut() {
Expand Down

0 comments on commit 59251f0

Please sign in to comment.