Browse Source

Only update access usernames where the username is changing #282

pull/283/head
Christopher Brickley 11 years ago
parent
commit
63e47405b2
  1. 10
      models/user.go

10
models/user.go

@ -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…
Cancel
Save