fix over-tabulation

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2024-07-21 01:08:03 +00:00
parent a88f913a17
commit 3dc91525ce

View file

@ -269,7 +269,7 @@ impl Service {
) -> Result<Option<SummaryAccessibility>> {
for server in via {
debug_info!("Asking {server} for /hierarchy");
if let Ok(response) = services()
let Ok(response) = services()
.sending
.send_federation_request(
server,
@ -279,7 +279,10 @@ impl Service {
},
)
.await
{
else {
continue;
};
debug_info!("Got response from {server} for /hierarchy\n{response:?}");
let summary = response.room.clone();
@ -341,7 +344,6 @@ impl Service {
return Ok(Some(SummaryAccessibility::Inaccessible));
}
}
self.roomid_spacehierarchy_cache
.lock()
@ -461,7 +463,10 @@ impl Service {
let mut results = Vec::new();
while let Some((current_room, via)) = { next_room_to_traverse(&mut stack, &mut parents) } {
if limit > results.len() {
if results.len() >= limit {
break;
}
match (
self.get_summary_and_children_client(&current_room, suggested_only, sender_user, &via)
.await?,
@ -526,9 +531,6 @@ impl Service {
// Just ignore other unavailable rooms
(None | Some(SummaryAccessibility::Inaccessible), false) => (),
}
} else {
break;
}
}
Ok(client::space::get_hierarchy::v1::Response {
@ -574,7 +576,10 @@ fn next_room_to_traverse(
async fn get_stripped_space_child_events(
room_id: &RoomId,
) -> Result<Option<Vec<Raw<HierarchySpaceChildEvent>>>, Error> {
if let Some(current_shortstatehash) = services().rooms.state.get_room_shortstatehash(room_id)? {
let Some(current_shortstatehash) = services().rooms.state.get_room_shortstatehash(room_id)? else {
return Ok(None);
};
let state = services()
.rooms
.state_accessor
@ -605,10 +610,8 @@ async fn get_stripped_space_child_events(
children_pdus.push(pdu.to_stripped_spacechild_state_event());
}
}
Ok(Some(children_pdus))
} else {
Ok(None)
}
}
/// With the given identifier, checks if a room is accessable