remove some unnecessary debug prints on notices

Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
strawberry 2024-11-02 18:52:25 -04:00
parent ee6af6c90e
commit 9466aeb088
No known key found for this signature in database
2 changed files with 24 additions and 19 deletions

View file

@ -100,8 +100,8 @@ pub(crate) async fn register_route(
if !services.globals.allow_registration() && body.appservice_info.is_none() {
info!(
"Registration disabled and request not from known appservice, rejecting registration attempt for username \
{:?}",
body.username
\"{}\"",
body.username.as_deref().unwrap_or("")
);
return Err(Error::BadRequest(ErrorKind::forbidden(), "Registration has been disabled."));
}
@ -114,8 +114,8 @@ pub(crate) async fn register_route(
{
info!(
"Guest registration disabled / registration enabled with token configured, rejecting guest registration \
attempt, initial device name: {:?}",
body.initial_device_display_name
attempt, initial device name: \"{}\"",
body.initial_device_display_name.as_deref().unwrap_or("")
);
return Err(Error::BadRequest(
ErrorKind::GuestAccessForbidden,
@ -128,8 +128,8 @@ pub(crate) async fn register_route(
if is_guest && services.users.count().await < 2 {
warn!(
"Guest account attempted to register before a real admin user has been registered, rejecting \
registration. Guest's initial device name: {:?}",
body.initial_device_display_name
registration. Guest's initial device name: \"{}\"",
body.initial_device_display_name.as_deref().unwrap_or("")
);
return Err(Error::BadRequest(ErrorKind::forbidden(), "Registration temporarily disabled."));
}
@ -312,12 +312,14 @@ pub(crate) async fn register_route(
debug_info!(%user_id, %device_id, "User account was created");
let device_display_name = body.initial_device_display_name.clone().unwrap_or_default();
let device_display_name = body.initial_device_display_name.as_deref().unwrap_or("");
// log in conduit admin channel if a non-guest user registered
if body.appservice_info.is_none() && !is_guest {
if !device_display_name.is_empty() {
info!("New user \"{user_id}\" registered on this server with device display name: {device_display_name}");
info!(
"New user \"{user_id}\" registered on this server with device display name: \"{device_display_name}\""
);
if services.globals.config.admin_room_notices {
services

View file

@ -33,10 +33,18 @@ pub(crate) async fn report_room_route(
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
info!(
"Received room report by user {sender_user} for room {} with reason: {:?}",
body.room_id, body.reason
"Received room report by user {sender_user} for room {} with reason: \"{}\"",
body.room_id,
body.reason.as_deref().unwrap_or("")
);
if body.reason.as_ref().is_some_and(|s| s.len() > 750) {
return Err(Error::BadRequest(
ErrorKind::InvalidParam,
"Reason too long, should be 750 characters or fewer",
));
};
delay_response().await;
if !services
@ -50,13 +58,6 @@ pub(crate) async fn report_room_route(
)));
}
if body.reason.as_ref().is_some_and(|s| s.len() > 750) {
return Err(Error::BadRequest(
ErrorKind::InvalidParam,
"Reason too long, should be 750 characters or fewer",
));
};
// send admin room message that we received the report with an @room ping for
// urgency
services
@ -85,8 +86,10 @@ pub(crate) async fn report_event_route(
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
info!(
"Received event report by user {sender_user} for room {} and event ID {}, with reason: {:?}",
body.room_id, body.event_id, body.reason
"Received event report by user {sender_user} for room {} and event ID {}, with reason: \"{}\"",
body.room_id,
body.event_id,
body.reason.as_deref().unwrap_or("")
);
delay_response().await;