mirror of
https://github.com/go-gitea/gitea.git
synced 2024-09-05 23:34:19 -04:00
Merge pull request #284 from compressed/user_name
Only update access usernames where the username is changing
This commit is contained in:
commit
590f9e599c
@ -297,10 +297,12 @@ func ChangeUserName(user *User, newUserName string) (err error) {
|
||||
}
|
||||
|
||||
for j := range accesses {
|
||||
accesses[j].UserName = newUserName
|
||||
accesses[j].RepoName = newUserName + "/" + repos[i].LowerName
|
||||
if err = UpdateAccessWithSession(sess, &accesses[j]); err != nil {
|
||||
return err
|
||||
// if the access is not the user's access (already updated above)
|
||||
if accesses[j].UserName != user.LowerName {
|
||||
accesses[j].RepoName = newUserName + "/" + repos[i].LowerName
|
||||
if err = UpdateAccessWithSession(sess, &accesses[j]); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user