split s2s into units
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
38238c309f
commit
3af153f5ae
23 changed files with 2260 additions and 2092 deletions
21
src/api/server/hierarchy.rs
Normal file
21
src/api/server/hierarchy.rs
Normal file
|
@ -0,0 +1,21 @@
|
|||
use ruma::api::{client::error::ErrorKind, federation::space::get_hierarchy};
|
||||
|
||||
use crate::{services, Error, Result, Ruma};
|
||||
|
||||
/// # `GET /_matrix/federation/v1/hierarchy/{roomId}`
|
||||
///
|
||||
/// Gets the space tree in a depth-first manner to locate child rooms of a given
|
||||
/// space.
|
||||
pub(crate) async fn get_hierarchy_route(body: Ruma<get_hierarchy::v1::Request>) -> Result<get_hierarchy::v1::Response> {
|
||||
let origin = body.origin.as_ref().expect("server is authenticated");
|
||||
|
||||
if services().rooms.metadata.exists(&body.room_id)? {
|
||||
services()
|
||||
.rooms
|
||||
.spaces
|
||||
.get_federation_hierarchy(&body.room_id, origin, body.suggested_only)
|
||||
.await
|
||||
} else {
|
||||
Err(Error::BadRequest(ErrorKind::NotFound, "Room does not exist."))
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue