From e97b7838c533b98c44ea008f8d6931058029616c Mon Sep 17 00:00:00 2001 From: Benjamin Bouvier Date: Mon, 12 Feb 2024 16:07:13 +0100 Subject: [PATCH] ffi: use the `Timeline::mark_as_read` function in `mark_as_read_and_send_read_receipt` --- bindings/matrix-sdk-ffi/src/room.rs | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/bindings/matrix-sdk-ffi/src/room.rs b/bindings/matrix-sdk-ffi/src/room.rs index 67d8aef91..89f361e84 100644 --- a/bindings/matrix-sdk-ffi/src/room.rs +++ b/bindings/matrix-sdk-ffi/src/room.rs @@ -551,22 +551,18 @@ impl Room { } /// Reverts a previously set unread flag and sends a read receipt to the - /// latest event in the room. Sending read receipts is useful when - /// executing this from the room list but shouldn't be use when entering - /// the room, the timeline should be left to its own devices in that - /// case. + /// latest event in the room. + /// + /// Sending read receipts is useful when executing this from the room list + /// but shouldn't be use when entering the room, the timeline should be + /// left to its own devices in that case. pub async fn mark_as_read_and_send_read_receipt( &self, receipt_type: ReceiptType, ) -> Result<(), ClientError> { let timeline = self.timeline().await?; - if let Some(event) = timeline.latest_event().await { - if let Err(error) = timeline.send_read_receipt(receipt_type, event.event_id().unwrap()) - { - error!("Failed to send read receipt: {error}"); - } - } + timeline.mark_as_read(receipt_type).await?; self.mark_as_read().await }