forked from forgejo/forgejo
Reduce usage of allcols on update (#2596)
* reduce usage of allcols on update * fix bug and tests
This commit is contained in:
parent
6b6f16cfae
commit
dd55534b82
10 changed files with 21 additions and 25 deletions
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue