Lightning bolt optional

This commit is contained in:
Jim 2022-06-23 06:58:34 +00:00 committed by Nyaaori
parent f430b87459
commit df8703cc13
No known key found for this signature in database
GPG key ID: E7819C3ED4D1F82E
5 changed files with 27 additions and 3 deletions

View file

@ -626,7 +626,13 @@ impl Service {
services().users.create(&user_id, Some(password.as_str()))?;
// Default to pretty displayname
let displayname = format!("{} ⚡️", user_id.localpart());
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(" ⚡️");
}
services()
.users
.set_displayname(&user_id, Some(displayname))?;

View file

@ -245,6 +245,10 @@ impl Service {
self.config.default_room_version.clone()
}
pub fn enable_lightning_bolt(&self) -> bool {
self.config.enable_lightning_bolt
}
pub fn trusted_servers(&self) -> &[OwnedServerName] {
&self.config.trusted_servers
}