mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-05-26 20:49:55 +00:00
style: Clean up whoami code
This commit is contained in:
@@ -733,16 +733,17 @@ pub(crate) async fn whoami_route(
|
|||||||
State(services): State<crate::State>,
|
State(services): State<crate::State>,
|
||||||
body: Ruma<whoami::v3::Request>,
|
body: Ruma<whoami::v3::Request>,
|
||||||
) -> Result<whoami::v3::Response> {
|
) -> Result<whoami::v3::Response> {
|
||||||
|
let is_guest = services
|
||||||
|
.users
|
||||||
|
.is_deactivated(body.sender_user())
|
||||||
|
.await
|
||||||
|
.map_err(|_| {
|
||||||
|
err!(Request(Forbidden("Application service has not registered this user.")))
|
||||||
|
})? && body.appservice_info.is_none();
|
||||||
Ok(whoami::v3::Response {
|
Ok(whoami::v3::Response {
|
||||||
user_id: body.sender_user().to_owned(),
|
user_id: body.sender_user().to_owned(),
|
||||||
device_id: body.sender_device.clone(),
|
device_id: body.sender_device.clone(),
|
||||||
is_guest: services
|
is_guest,
|
||||||
.users
|
|
||||||
.is_deactivated(body.sender_user())
|
|
||||||
.await
|
|
||||||
.map_err(|_| {
|
|
||||||
err!(Request(Forbidden("Application service has not registered this user.")))
|
|
||||||
})? && body.appservice_info.is_none(),
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user