Skip to content

Commit

Permalink
fixup!: fixes after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
jmartinesp committed Jul 23, 2024
1 parent 886bab3 commit 31bbc74
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion bindings/matrix-sdk-ffi/src/room_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
12 changes: 10 additions & 2 deletions crates/matrix-sdk-ui/src/timeline/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<bool> {
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)
Expand All @@ -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<bool> {
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);
Expand Down

0 comments on commit 31bbc74

Please sign in to comment.