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