Skip to content

Commit 0b14496

Browse files
committed
Filter out the current parent space from the /hierarchy responses and SpaceServiceRoomList instances.
1 parent ca8a4c7 commit 0b14496

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

crates/matrix-sdk-ui/src/spaces/room_list.rs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -155,15 +155,16 @@ impl SpaceServiceRoomList {
155155
result
156156
.rooms
157157
.iter()
158-
.map(|room| {
159-
(
160-
&room.summary,
161-
self.client.get_room(&room.summary.room_id),
162-
room.children_state.len(),
163-
)
164-
})
165-
.map(|(summary, room, children_count)| {
166-
SpaceServiceRoom::new_from_summary(summary, room, children_count as u64)
158+
.flat_map(|room| {
159+
if room.summary.room_id == self.parent_space_id {
160+
None
161+
} else {
162+
Some(SpaceServiceRoom::new_from_summary(
163+
&room.summary,
164+
self.client.get_room(&room.summary.room_id),
165+
room.children_state.len() as u64,
166+
))
167+
}
167168
})
168169
.collect::<Vec<_>>(),
169170
);
@@ -238,7 +239,7 @@ mod tests {
238239
// Paginating the room list
239240
server
240241
.mock_get_hierarchy()
241-
.ok_with_room_ids(vec![child_space_id_1, child_space_id_2])
242+
.ok_with_room_ids(vec![parent_space_id, child_space_id_1, child_space_id_2])
242243
.mount()
243244
.await;
244245

0 commit comments

Comments
 (0)