diff --git a/bindings/matrix-sdk-ffi/src/room_info.rs b/bindings/matrix-sdk-ffi/src/room_info.rs index bff6fd4886e..1dad22af707 100644 --- a/bindings/matrix-sdk-ffi/src/room_info.rs +++ b/bindings/matrix-sdk-ffi/src/room_info.rs @@ -66,7 +66,7 @@ impl RoomInfo { for (id, level) in power_levels_map.iter() { user_power_levels.insert(id.to_string(), *level); } - let pinned_event_ids = room.pinned_events().get().iter().map(|id| id.to_string()).collect(); + let pinned_event_ids = room.pinned_events().iter().map(|id| id.to_string()).collect(); Ok(Self { id: room.room_id().to_string(), diff --git a/crates/matrix-sdk-ui/src/timeline/mod.rs b/crates/matrix-sdk-ui/src/timeline/mod.rs index 3d1623b899a..afe37dcdb74 100644 --- a/crates/matrix-sdk-ui/src/timeline/mod.rs +++ b/crates/matrix-sdk-ui/src/timeline/mod.rs @@ -872,8 +872,12 @@ impl Timeline { } } + /// Adds a new pinned event by sending an updated `m.room.pinned_events` event containing the + /// new event id. + /// + /// Returns a boolean indicating if we sent the request or not. pub async fn pin_event(&self, event_id: &EventId) -> Result { - let mut pinned_events = self.room().pinned_events().get(); + let mut pinned_events = self.room().pinned_events(); let event_id = event_id.to_owned(); if pinned_events.contains(&event_id) { Ok(false) @@ -884,8 +888,12 @@ impl Timeline { } } + /// Adds a new pinned event by sending an updated `m.room.pinned_events` event without the + /// event id we want to remove. + /// + /// Returns a boolean indicating if we sent the request or not. pub async fn unpin_event(&self, event_id: &EventId) -> Result { - let mut pinned_events = self.room().pinned_events().get(); + let mut pinned_events = self.room().pinned_events(); let event_id = event_id.to_owned(); if let Some(idx) = pinned_events.iter().position(|e| *e == *event_id) { pinned_events.remove(idx);