Finish organization homepage

This commit is contained in:
Unknown 2014-06-28 15:43:25 -04:00
parent 6e448b0714
commit 5dbfe3c26c
9 changed files with 179 additions and 109 deletions

View file

@ -73,6 +73,8 @@ type User struct {
Description string
NumTeams int
NumMembers int
Teams []*Team `xorm:"-"`
Members []*User `xorm:"-"`
}
// HomeLink returns the user home page link.
@ -110,6 +112,11 @@ func (u *User) IsOrganization() bool {
return u.Type == ORGANIZATION
}
// GetOrganizationCount returns count of membership of organization of user.
func (u *User) GetOrganizationCount() (int64, error) {
return x.Where("uid=?", u.Id).Count(new(OrgUser))
}
// GetOrganizations returns all organizations that user belongs to.
func (u *User) GetOrganizations() error {
ous, err := GetOrgUsersByUserId(u.Id)
@ -331,7 +338,7 @@ func DeleteUser(u *User) error {
}
// Check membership of organization.
count, err = GetOrganizationCount(u)
count, err = u.GetOrganizationCount()
if err != nil {
return errors.New("modesl.GetRepositories(GetOrganizationCount): " + err.Error())
} else if count > 0 {