db: remove db.User.LoginType field (#6122)

This commit is contained in:
Kousik Mitra
2020-04-19 02:02:53 +05:30
committed by GitHub
parent c0fd6042fd
commit 5a52ee75e3
5 changed files with 14 additions and 25 deletions

View File

@@ -53,10 +53,9 @@ type User struct {
Name string `xorm:"UNIQUE NOT NULL" gorm:"NOT NULL"`
FullName string
// Email is the primary email address (to be used for communication)
Email string `xorm:"NOT NULL" gorm:"NOT NULL"`
Passwd string `xorm:"NOT NULL" gorm:"NOT NULL"`
LoginType LoginType // TODO: Remove me https://github.com/gogs/gogs/issues/6117.
LoginSource int64 `xorm:"NOT NULL DEFAULT 0" gorm:"NOT NULL;DEFAULT:0"`
Email string `xorm:"NOT NULL" gorm:"NOT NULL"`
Passwd string `xorm:"NOT NULL" gorm:"NOT NULL"`
LoginSource int64 `xorm:"NOT NULL DEFAULT 0" gorm:"NOT NULL;DEFAULT:0"`
LoginName string
Type UserType
OwnedOrgs []*User `xorm:"-" gorm:"-" json:"-"`
@@ -142,7 +141,7 @@ func (u *User) APIFormat() *api.User {
// returns true if user login type is LoginPlain.
func (u *User) IsLocal() bool {
return u.LoginType <= LoginPlain
return u.LoginSource <= 0
}
// HasForkedRepo checks if user has already forked a repository with given ID.