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.
@@ -108,19 +108,11 @@ impl TimelineInner {
pub(super) fn add_event_id(&self, txn_id: &TransactionId, event_id: OwnedEventId) {
let mut lock = self.items.lock_mut();
if let Some((idx, item)) = find_event_by_txn_id(&lock, txn_id) {
- match &item.key {
- TimelineKey::TransactionId(_) => {
- lock.set_cloned(
- idx,
- Arc::new(TimelineItem::Event(item.with_event_id(Some(event_id)))),
- );
- }
- TimelineKey::EventId(ev_id) => {
- if *ev_id != event_id {
+ if item.event_id.as_ref().map_or(false, |ev_id| *ev_id != event_id) {
error!("remote echo and send-event response disagree on the event ID");
}
- }
- }
+
+ lock.set_cloned(idx, Arc::new(TimelineItem::Event(item.with_event_id(Some(event_id)))));
} else {
warn!(%txn_id, "Timeline item not found, can't add event ID");
}
