From 33b3bca0020c5fab0ab4cba8e07ee5074f1e3d5d Mon Sep 17 00:00:00 2001 From: Benjamin Bouvier Date: Thu, 25 Jul 2024 12:37:13 +0200 Subject: [PATCH] send queue: use the transaction id generated and saved in the db for network queries Intense facepalm energy here. --- crates/matrix-sdk-base/src/store/traits.rs | 6 ++++++ crates/matrix-sdk/src/send_queue.rs | 10 ++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/crates/matrix-sdk-base/src/store/traits.rs b/crates/matrix-sdk-base/src/store/traits.rs index 315ea1784c1..2febb12fc85 100644 --- a/crates/matrix-sdk-base/src/store/traits.rs +++ b/crates/matrix-sdk-base/src/store/traits.rs @@ -1288,6 +1288,12 @@ impl From for ChildTransactionId { } } +impl Into for ChildTransactionId { + fn into(self) -> OwnedTransactionId { + self.0 + } +} + /// An event to be sent, depending on a [`QueuedEvent`] to be sent first. /// /// Depending on whether the event has been sent or not, this will either update diff --git a/crates/matrix-sdk/src/send_queue.rs b/crates/matrix-sdk/src/send_queue.rs index 12ac14bcd2d..040025022a7 100644 --- a/crates/matrix-sdk/src/send_queue.rs +++ b/crates/matrix-sdk/src/send_queue.rs @@ -852,7 +852,11 @@ impl QueueStorage { ); store - .save_send_queue_event(&self.room_id, TransactionId::new(), serializable) + .save_send_queue_event( + &self.room_id, + de.own_transaction_id.into(), + serializable, + ) .await .map_err(RoomSendQueueStorageError::StorageError)?; } else { @@ -887,7 +891,9 @@ impl QueueStorage { // Note: no reason is provided because we materialize the intent of "cancel // sending the parent event". - if let Err(err) = room.redact(&event_id, None, None).await { + if let Err(err) = + room.redact(&event_id, None, Some(de.own_transaction_id.into())).await + { warn!("error when sending a redact for {event_id}: {err}"); } } else {