Skip to content

Commit b34a2cd

Browse files
authored
Merge pull request #3559 from matrix-org/feat-sdk-sliding-sync-get-room-id
chore(sdk): Remove the useless `SlidingSyncList::get_room_id` method
2 parents 72adaf4 + 304c225 commit b34a2cd

File tree

1 file changed

+0
-39
lines changed
  • crates/matrix-sdk/src/sliding_sync/list

1 file changed

+0
-39
lines changed

crates/matrix-sdk/src/sliding_sync/list/mod.rs

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -174,16 +174,6 @@ impl SlidingSyncList {
174174
Observable::subscribe(&self.inner.maximum_number_of_rooms.read().unwrap())
175175
}
176176

177-
/// Return the `room_id` at the given index.
178-
pub fn get_room_id(&self, index: usize) -> Option<OwnedRoomId> {
179-
self.inner
180-
.room_list
181-
.read()
182-
.unwrap()
183-
.get(index)
184-
.and_then(|room_list_entry| room_list_entry.as_room_id().map(ToOwned::to_owned))
185-
}
186-
187177
/// Calculate the next request and return it.
188178
///
189179
/// The next request is entirely calculated based on the request generator
@@ -990,35 +980,6 @@ mod tests {
990980
assert_eq!(list.inner.sticky.read().unwrap().data().timeline_limit(), None);
991981
}
992982

993-
#[test]
994-
fn test_sliding_sync_get_room_id() {
995-
let (sender, _receiver) = channel(1);
996-
997-
let mut list = SlidingSyncList::builder("foo")
998-
.sync_mode(SlidingSyncMode::new_selective().add_range(0..=1))
999-
.build(sender);
1000-
1001-
let room0 = room_id!("!room0:bar.org");
1002-
let room1 = room_id!("!room1:bar.org");
1003-
1004-
// Simulate a request.
1005-
let _ = list.next_request(&mut LazyTransactionId::new());
1006-
1007-
// A new response.
1008-
let sync0: v4::SyncOp = serde_json::from_value(json!({
1009-
"op": SlidingOp::Sync,
1010-
"range": [0, 1],
1011-
"room_ids": [room0, room1],
1012-
}))
1013-
.unwrap();
1014-
1015-
list.update(Some(6), &[sync0], &[]).unwrap();
1016-
1017-
assert_eq!(list.get_room_id(0), Some(room0.to_owned()));
1018-
assert_eq!(list.get_room_id(1), Some(room1.to_owned()));
1019-
assert_eq!(list.get_room_id(2), None);
1020-
}
1021-
1022983
macro_rules! assert_ranges {
1023984
(
1024985
list = $list:ident,

0 commit comments

Comments
 (0)