mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
fix: allow for alternate usernames on conflict (#4614)
This commit is contained in:
@@ -2221,6 +2221,12 @@ func (q *fakeQuerier) InsertUser(_ context.Context, arg database.InsertUserParam
|
||||
q.mutex.Lock()
|
||||
defer q.mutex.Unlock()
|
||||
|
||||
for _, user := range q.users {
|
||||
if user.Username == arg.Username && !user.Deleted {
|
||||
return database.User{}, errDuplicateKey
|
||||
}
|
||||
}
|
||||
|
||||
user := database.User{
|
||||
ID: arg.ID,
|
||||
Email: arg.Email,
|
||||
|
||||
Reference in New Issue
Block a user