mirror of
https://github.com/stoatchat/stoatchat.git
synced 2026-07-14 13:36:59 +00:00
Allow users to change case of own username
Usernames are case-insensitive so now one have the name `foo` and someone else have the name `FOO`, but user `foo` should be able to change their own name to `FOO` if they want to for display purposes.
This commit is contained in:
@@ -45,7 +45,8 @@ pub async fn req(
|
||||
|
||||
let mut set = doc! {};
|
||||
if let Some(username) = &data.username {
|
||||
if User::is_username_taken(&username).await? {
|
||||
if username.to_lowercase() == user.username.to_lowercase() {
|
||||
} else if User::is_username_taken(&username).await? {
|
||||
return Err(Error::UsernameTaken);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user