usernames: report reserved names as taken in the check paths too
account.checkUsername / channels.checkUsername / bots.checkUsername said a reserved name was available and only updateUsername rejected it. Add the blocklist check to peerUsernameAvailable (covers account + channel, both backends) and to bots.Service.CheckUsername, so the client shows "username is taken" immediately.
This commit is contained in:
parent
5b2f68c61e
commit
367f2be59c
7 changed files with 79 additions and 5 deletions
|
|
@ -158,6 +158,9 @@ func (s *UserStore) CheckUsername(_ context.Context, userID int64, username stri
|
|||
if username == "" {
|
||||
return true, nil
|
||||
}
|
||||
if s.usernameRegistry != nil && s.usernameRegistry.nameReserved(username) {
|
||||
return false, nil
|
||||
}
|
||||
s.mu.RLock()
|
||||
defer s.mu.RUnlock()
|
||||
for id, u := range s.byID {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue