diff options
Diffstat (limited to 'models/user.go')
-rw-r--r-- | models/user.go | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/models/user.go b/models/user.go index 831ba3f4..ab836b49 100644 --- a/models/user.go +++ b/models/user.go @@ -26,13 +26,13 @@ import ( "golang.org/x/crypto/pbkdf2" log "gopkg.in/clog.v1" - "github.com/gogits/git-module" - api "github.com/gogits/go-gogs-client" + "github.com/gogs/git-module" + api "github.com/gogs/go-gogs-client" - "github.com/gogits/gogs/models/errors" - "github.com/gogits/gogs/pkg/avatar" - "github.com/gogits/gogs/pkg/setting" - "github.com/gogits/gogs/pkg/tool" + "github.com/gogs/gogs/models/errors" + "github.com/gogs/gogs/pkg/avatar" + "github.com/gogs/gogs/pkg/setting" + "github.com/gogs/gogs/pkg/tool" ) type UserType int @@ -55,17 +55,17 @@ type User struct { LoginSource int64 `xorm:"NOT NULL DEFAULT 0"` LoginName string Type UserType - OwnedOrgs []*User `xorm:"-"` - Orgs []*User `xorm:"-"` - Repos []*Repository `xorm:"-"` + OwnedOrgs []*User `xorm:"-" json:"-"` + Orgs []*User `xorm:"-" json:"-"` + Repos []*Repository `xorm:"-" json:"-"` Location string Website string Rands string `xorm:"VARCHAR(10)"` Salt string `xorm:"VARCHAR(10)"` - Created time.Time `xorm:"-"` + Created time.Time `xorm:"-" json:"-"` CreatedUnix int64 - Updated time.Time `xorm:"-"` + Updated time.Time `xorm:"-" json:"-"` UpdatedUnix int64 // Remember visibility choice for convenience, true for private @@ -95,8 +95,8 @@ type User struct { Description string NumTeams int NumMembers int - Teams []*Team `xorm:"-"` - Members []*User `xorm:"-"` + Teams []*Team `xorm:"-" json:"-"` + Members []*User `xorm:"-" json:"-"` } func (u *User) BeforeInsert() { @@ -120,6 +120,11 @@ func (u *User) AfterSet(colName string, _ xorm.Cell) { } } +// IDStr returns string representation of user's ID. +func (u *User) IDStr() string { + return com.ToStr(u.ID) +} + func (u *User) APIFormat() *api.User { return &api.User{ ID: u.ID, |