chore: Move registration notice logic

This commit is contained in:
timedout committed 2026-07-27 16:46:36 +01:00
1 parent 7fdc7f9216
commit 399005abc6
5 files changed
+39 -33

No files matched your search

+22 -1
View File
@@ -1,4 +1,7 @@
use std::time::{Duration, SystemTime};
use std::{
net::IpAddr,
time::{Duration, SystemTime},
};
use conduwuit::{
Err, Result, debug_error, debug_warn, err, error, info, trace,
@@ -136,6 +139,8 @@ impl super::Service {
user_id: &UserId,
password: Option<HashedPassword>,
email: Option<Address>,
client: Option<&IpAddr>,
device_name: Option<&str>,
) -> Result<()> {
self.create_shadow_account(user_id).await?;
@@ -143,6 +148,22 @@ impl super::Service {
self.convert_to_local_account(user_id, password).await?;
}
if let Some(client) = client {
let notice = if let Some(device_name) = device_name {
format!(
"New user \"{user_id}\" registered on this server from IP {client} and \
device display name \"{device_name}\".",
)
} else {
format!("New user \"{user_id}\" registered on this server from IP {client}.")
};
info!("{notice}");
if self.services.config.admin_room_notices {
self.services.admin.notice(&notice).await;
}
}
// Set an initial display name
{
let mut displayname = user_id.localpart().to_owned();