mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-24 13:09:23 -05: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
1 changed files with 6 additions and 4 deletions
|
@ -297,10 +297,12 @@ func ChangeUserName(user *User, newUserName string) (err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for j := range accesses {
|
for j := range accesses {
|
||||||
accesses[j].UserName = newUserName
|
// if the access is not the user's access (already updated above)
|
||||||
accesses[j].RepoName = newUserName + "/" + repos[i].LowerName
|
if accesses[j].UserName != user.LowerName {
|
||||||
if err = UpdateAccessWithSession(sess, &accesses[j]); err != nil {
|
accesses[j].RepoName = newUserName + "/" + repos[i].LowerName
|
||||||
return err
|
if err = UpdateAccessWithSession(sess, &accesses[j]); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue