reduce line width on banned_room_check
Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
parent
c070edc189
commit
a1b0369033
1 changed files with 74 additions and 72 deletions
|
@ -56,8 +56,11 @@ use crate::{client::full_user_deactivate, Ruma};
|
||||||
async fn banned_room_check(
|
async fn banned_room_check(
|
||||||
services: &Services, user_id: &UserId, room_id: Option<&RoomId>, server_name: Option<&ServerName>,
|
services: &Services, user_id: &UserId, room_id: Option<&RoomId>, server_name: Option<&ServerName>,
|
||||||
client_ip: IpAddr,
|
client_ip: IpAddr,
|
||||||
) -> Result<()> {
|
) -> Result {
|
||||||
if !services.users.is_admin(user_id).await {
|
if services.users.is_admin(user_id).await {
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
|
||||||
if let Some(room_id) = room_id {
|
if let Some(room_id) = room_id {
|
||||||
if services.rooms.metadata.is_banned(room_id).await
|
if services.rooms.metadata.is_banned(room_id).await
|
||||||
|| services
|
|| services
|
||||||
|
@ -106,8 +109,8 @@ async fn banned_room_check(
|
||||||
.contains(&server_name.to_owned())
|
.contains(&server_name.to_owned())
|
||||||
{
|
{
|
||||||
warn!(
|
warn!(
|
||||||
"User {user_id} who is not an admin tried joining a room which has the server name {server_name} \
|
"User {user_id} who is not an admin tried joining a room which has the server name {server_name} that \
|
||||||
that is globally forbidden. Rejecting.",
|
is globally forbidden. Rejecting.",
|
||||||
);
|
);
|
||||||
|
|
||||||
if services.globals.config.auto_deactivate_banned_room_attempts {
|
if services.globals.config.auto_deactivate_banned_room_attempts {
|
||||||
|
@ -138,7 +141,6 @@ async fn banned_room_check(
|
||||||
return Err!(Request(Forbidden("This remote server is banned on this homeserver.")));
|
return Err!(Request(Forbidden("This remote server is banned on this homeserver.")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue