feat: custom text for user displayname suffix upon registration

replaces the lightning bolt emoji option with support for
your own text or emojis

Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
strawberry 2024-02-20 23:08:53 -05:00 committed by June
parent 0972079319
commit 1ecad225be
5 changed files with 24 additions and 16 deletions

View file

@ -233,9 +233,9 @@ pub async fn register_route(body: Ruma<register::v3::Request>) -> Result<registe
// Default to pretty displayname
let mut displayname = user_id.localpart().to_owned();
// If enabled append lightning bolt to display name (default true)
if services().globals.enable_lightning_bolt() {
displayname.push_str(" ⚡️");
// If `new_user_displayname_suffix` is set, registration will push whatever content is set to the user's display name with a space before it
if !services().globals.new_user_displayname_suffix().is_empty() {
displayname.push_str(&(" ".to_owned() + services().globals.new_user_displayname_suffix()));
}
services()