diff options
author | Unknwon <u@gogs.io> | 2015-08-30 01:13:24 +0800 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2015-08-30 01:13:24 +0800 |
commit | d01f688257b028132fd75fd7200093c97282a97d (patch) | |
tree | 56dbdd78c17aff0de808363acf21420d709716b3 /models/user.go | |
parent | 9b9e5f02901ab457656ee80bf7b27a663db4d73f (diff) | |
download | gitea-d01f688257b028132fd75fd7200093c97282a97d.tar.gz gitea-d01f688257b028132fd75fd7200093c97282a97d.zip |
fix repository count of user is messed up
Diffstat (limited to 'models/user.go')
-rw-r--r-- | models/user.go | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/models/user.go b/models/user.go index c7e42dce0b..e19fe73896 100644 --- a/models/user.go +++ b/models/user.go @@ -479,10 +479,9 @@ func ChangeUserName(u *User, newUserName string) (err error) { return os.Rename(UserPath(u.LowerName), UserPath(newUserName)) } -// UpdateUser updates user's information. -func UpdateUser(u *User) error { +func updateUser(e Engine, u *User) error { u.Email = strings.ToLower(u.Email) - has, err := x.Where("id!=?", u.Id).And("type=?", u.Type).And("email=?", u.Email).Get(new(User)) + has, err := e.Where("id!=?", u.Id).And("type=?", u.Type).And("email=?", u.Email).Get(new(User)) if err != nil { return err } else if has { @@ -507,10 +506,15 @@ func UpdateUser(u *User) error { u.Avatar = avatar.HashEmail(u.AvatarEmail) u.FullName = base.Sanitizer.Sanitize(u.FullName) - _, err = x.Id(u.Id).AllCols().Update(u) + _, err = e.Id(u.Id).AllCols().Update(u) return err } +// UpdateUser updates user's information. +func UpdateUser(u *User) error { + return updateUser(x, u) +} + // DeleteBeans deletes all given beans, beans should contain delete conditions. func DeleteBeans(e Engine, beans ...interface{}) (err error) { for i := range beans { |