Fix account availability on register

This commit is contained in:
Neil Alexander 2022-03-28 13:31:17 +01:00
parent 8099bcbc8b
commit 0692be44d9
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944

View file

@ -776,12 +776,8 @@ func (a *UserInternalAPI) QueryNumericLocalpart(ctx context.Context, res *api.Qu
}
func (a *UserInternalAPI) QueryAccountAvailability(ctx context.Context, req *api.QueryAccountAvailabilityRequest, res *api.QueryAccountAvailabilityResponse) error {
_, err := a.DB.CheckAccountAvailability(ctx, req.Localpart)
if err == sql.ErrNoRows {
res.Available = true
return nil
}
res.Available = false
var err error
res.Available, err = a.DB.CheckAccountAvailability(ctx, req.Localpart)
return err
}