Skip to content

Commit ddde87f

Browse files
committed
fix(sdk): Fix remote echo event_id check
The send-event response sets the event_id field, not the timeline key. The previous error branch wasn't actually reachable.
1 parent 3e1fddc commit ddde87f

File tree

1 file changed

+4
-12
lines changed
  • crates/matrix-sdk/src/room/timeline

1 file changed

+4
-12
lines changed

crates/matrix-sdk/src/room/timeline/inner.rs

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -108,19 +108,11 @@ impl TimelineInner {
108108
pub(super) fn add_event_id(&self, txn_id: &TransactionId, event_id: OwnedEventId) {
109109
let mut lock = self.items.lock_mut();
110110
if let Some((idx, item)) = find_event_by_txn_id(&lock, txn_id) {
111-
match &item.key {
112-
TimelineKey::TransactionId(_) => {
113-
lock.set_cloned(
114-
idx,
115-
Arc::new(TimelineItem::Event(item.with_event_id(Some(event_id)))),
116-
);
117-
}
118-
TimelineKey::EventId(ev_id) => {
119-
if *ev_id != event_id {
120-
error!("remote echo and send-event response disagree on the event ID");
121-
}
122-
}
111+
if item.event_id.as_ref().map_or(false, |ev_id| *ev_id != event_id) {
112+
error!("remote echo and send-event response disagree on the event ID");
123113
}
114+
115+
lock.set_cloned(idx, Arc::new(TimelineItem::Event(item.with_event_id(Some(event_id)))));
124116
} else {
125117
warn!(%txn_id, "Timeline item not found, can't add event ID");
126118
}

0 commit comments

Comments
 (0)