diff options
Diffstat (limited to 'internal/db/user.go')
-rw-r--r-- | internal/db/user.go | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/internal/db/user.go b/internal/db/user.go index 5d75bfca..24af0ec1 100644 --- a/internal/db/user.go +++ b/internal/db/user.go @@ -31,14 +31,6 @@ func (u *User) BeforeInsert() { u.UpdatedUnix = u.CreatedUnix } -// TODO(unknwon): Refactoring together with methods that do updates. -func (u *User) BeforeUpdate() { - if u.MaxRepoCreation < -1 { - u.MaxRepoCreation = -1 - } - u.UpdatedUnix = time.Now().Unix() -} - // TODO(unknwon): Delete me once refactoring is done. func (u *User) AfterSet(colName string, _ xorm.Cell) { switch colName { @@ -49,13 +41,6 @@ func (u *User) AfterSet(colName string, _ xorm.Cell) { } } -// Deprecated: Use OrgsUsers.CountByUser instead. -// -// TODO(unknwon): Delete me once no more call sites in this file. -func (u *User) getOrganizationCount(e Engine) (int64, error) { - return e.Where("uid=?", u.ID).Count(new(OrgUser)) -} - func updateUser(e Engine, u *User) error { // Organization does not need email if !u.IsOrganization() { @@ -82,6 +67,14 @@ func updateUser(e Engine, u *User) error { return err } +// TODO(unknwon): Refactoring together with methods that do updates. +func (u *User) BeforeUpdate() { + if u.MaxRepoCreation < -1 { + u.MaxRepoCreation = -1 + } + u.UpdatedUnix = time.Now().Unix() +} + // UpdateUser updates user's information. func UpdateUser(u *User) error { return updateUser(x, u) @@ -202,6 +195,13 @@ func deleteUser(e *xorm.Session, u *User) error { return nil } +// Deprecated: Use OrgsUsers.CountByUser instead. +// +// TODO(unknwon): Delete me once no more call sites in this file. +func (u *User) getOrganizationCount(e Engine) (int64, error) { + return e.Where("uid=?", u.ID).Count(new(OrgUser)) +} + // DeleteUser completely and permanently deletes everything of a user, // but issues/comments/pulls will be kept and shown as someone has been deleted. func DeleteUser(u *User) (err error) { |