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:
Astra 2026-09-09 21:41:53 +01:00
parent 5b2f68c61e
commit 367f2be59c
7 changed files with 79 additions and 5 deletions

View file

@ -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 {