mirror of
https://codeberg.org/davrot/forgejo.git
synced 2025-05-25 12:00:01 +02:00
Finish organization homepage
This commit is contained in:
parent
6e448b0714
commit
5dbfe3c26c
9 changed files with 179 additions and 109 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue