mirror of
https://github.com/go-gitea/gitea.git
synced 2024-05-11 05:55:29 +00:00
Reduce usage of allcols on update (#2596)
* reduce usage of allcols on update * fix bug and tests
This commit is contained in:
@ -874,6 +874,10 @@ func UpdateUser(u *User) error {
|
||||
|
||||
// UpdateUserCols update user according special columns
|
||||
func UpdateUserCols(u *User, cols ...string) error {
|
||||
return updateUserCols(x, u, cols...)
|
||||
}
|
||||
|
||||
func updateUserCols(e Engine, u *User, cols ...string) error {
|
||||
// Organization does not need email
|
||||
u.Email = strings.ToLower(u.Email)
|
||||
if !u.IsOrganization() {
|
||||
@ -890,7 +894,7 @@ func UpdateUserCols(u *User, cols ...string) error {
|
||||
u.Website = base.TruncateString(u.Website, 255)
|
||||
u.Description = base.TruncateString(u.Description, 255)
|
||||
|
||||
_, err := x.Id(u.ID).Cols(cols...).Update(u)
|
||||
_, err := e.Id(u.ID).Cols(cols...).Update(u)
|
||||
return err
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user