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
60537342d3
commit
f1c24e483c
7 changed files with 79 additions and 5 deletions
|
|
@ -1234,10 +1234,12 @@ func run(logger *zap.Logger) error {
|
|||
account.WithLoginEmailVerification(codeStore, loginEmailSender, cfg.AuthCodeTTL, cfg.AuthCodeMaxAttempts, cfg.LoginEmailCodeLength))
|
||||
}
|
||||
accountService := account.NewService(passwordStore, accountOptions...)
|
||||
reservedUsernameStore := postgres.NewReservedUsernameStore(pool)
|
||||
botsService := botsapp.NewService(userStore, botStore, messageStore,
|
||||
botsapp.WithLogger(logger.Named("bots")),
|
||||
botsapp.WithBlockChecker(contactStore),
|
||||
botsapp.WithPublicChannelUsernameResolver(channelStore),
|
||||
botsapp.WithReservedUsernames(reservedUsernameStore),
|
||||
botsapp.WithUserCache(userCache),
|
||||
botsapp.WithStickerSetCreator(filesService),
|
||||
botsapp.WithGifCatalogSource(filesService),
|
||||
|
|
@ -1491,7 +1493,6 @@ func run(logger *zap.Logger) error {
|
|||
// Collectible (NFT) usernames are an optional read model projected at the
|
||||
// protocol edge.
|
||||
collectibleUsernameStore := postgres.NewCollectibleUsernameStore(pool)
|
||||
reservedUsernameStore := postgres.NewReservedUsernameStore(pool)
|
||||
usernamesService := usernamesapp.NewService(
|
||||
usernamesapp.WithRegistryStore(collectibleUsernameStore),
|
||||
usernamesapp.WithCollectibleStore(collectibleUsernameStore),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue