don't debug log device display name for guest registrations

Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
strawberry 2024-04-14 13:42:14 -04:00 committed by June
parent 71611f0ae5
commit 27f8c5b63d
1 changed files with 26 additions and 6 deletions

View File

@ -291,12 +291,32 @@ pub async fn register_route(body: Ruma<register::v3::Request>) -> Result<registe
// log in conduit admin channel if a guest registered
if !body.from_appservice && is_guest && services().globals.log_guest_registrations() {
if let Some(device_display_name) = &body.initial_device_display_name {
if body
.initial_device_display_name
.as_ref()
.is_some_and(|device_display_name| !device_display_name.is_empty())
{
services()
.admin
.send_message(RoomMessageEventContent::notice_plain(format!(
"Guest user \"{user_id}\" with device display name `{:?}` registered on this server.",
body.initial_device_display_name
"Guest user \"{user_id}\" with device display name `{device_display_name}` registered on this \
server."
)));
} else {
services()
.admin
.send_message(RoomMessageEventContent::notice_plain(format!(
"Guest user \"{user_id}\" with no device display name registered on this server.",
)));
}
} else {
services()
.admin
.send_message(RoomMessageEventContent::notice_plain(format!(
"Guest user \"{user_id}\" with no device display name registered on this server.",
)));
}
}
// If this is the first real user, grant them admin privileges except for guest