de-global services() from api
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
463f1a1287
commit
8b6018d77d
61 changed files with 1485 additions and 1320 deletions
|
@ -1,16 +1,19 @@
|
|||
use axum::extract::State;
|
||||
use ruma::api::{client::error::ErrorKind, federation::space::get_hierarchy};
|
||||
|
||||
use crate::{services, Error, Result, Ruma};
|
||||
use crate::{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> {
|
||||
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)? {
|
||||
services()
|
||||
if services.rooms.metadata.exists(&body.room_id)? {
|
||||
services
|
||||
.rooms
|
||||
.spaces
|
||||
.get_federation_hierarchy(&body.room_id, origin, body.suggested_only)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue