summaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorChristopher Brickley <brickley@gmail.com>2014-07-11 20:57:00 -0400
committerChristopher Brickley <brickley@gmail.com>2014-07-11 20:57:00 -0400
commit63e47405b262023e00f38a52446609dafbe83ce2 (patch)
tree0639d17b5b80689fd0adce1bdf2f7263344bc682 /models
parentc127d8477759d0236cb599b9bde3d8fe9449d723 (diff)
downloadgitea-63e47405b262023e00f38a52446609dafbe83ce2.tar.gz
gitea-63e47405b262023e00f38a52446609dafbe83ce2.zip
Only update access usernames where the username is changing #282
Diffstat (limited to 'models')
-rw-r--r--models/user.go10
1 files changed, 6 insertions, 4 deletions
diff --git a/models/user.go b/models/user.go
index 47f1d45f0e..7838d2471d 100644
--- a/models/user.go
+++ b/models/user.go
@@ -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
+ }
}
}
}