add some accessors to Ar for common patterns
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
60cc07134f
commit
ee92a33a4d
17 changed files with 109 additions and 147 deletions
|
@ -10,13 +10,11 @@ use crate::{Error, Result, Ruma};
|
|||
pub(crate) async fn get_hierarchy_route(
|
||||
State(services): State<crate::State>, 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).await {
|
||||
services
|
||||
.rooms
|
||||
.spaces
|
||||
.get_federation_hierarchy(&body.room_id, origin, body.suggested_only)
|
||||
.get_federation_hierarchy(&body.room_id, body.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