diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2019-12-06 13:34:54 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-06 13:34:54 +0800 |
commit | e3081c667a44db469fac1e1de2d03b2d3106f100 (patch) | |
tree | b2d0bbefd1f1aef55adf1570c8782949a34ad819 /routers/api | |
parent | 77730db25768036a12e16cef9839b9492218303f (diff) | |
download | gitea-e3081c667a44db469fac1e1de2d03b2d3106f100.tar.gz gitea-e3081c667a44db469fac1e1de2d03b2d3106f100.zip |
Only show part of members on orgnization dashboard and add paging for orgnization members page (#9092)
* Only show part of members on orgnization dashboard and add paging for orgnization members page
* fix test
* fix typo
Diffstat (limited to 'routers/api')
-rw-r--r-- | routers/api/v1/org/member.go | 31 |
1 files changed, 7 insertions, 24 deletions
diff --git a/routers/api/v1/org/member.go b/routers/api/v1/org/member.go index be47b6963f..45519e5606 100644 --- a/routers/api/v1/org/member.go +++ b/routers/api/v1/org/member.go @@ -18,30 +18,13 @@ import ( // listMembers list an organization's members func listMembers(ctx *context.APIContext, publicOnly bool) { var members []*models.User - if publicOnly { - orgUsers, err := models.GetOrgUsersByOrgID(ctx.Org.Organization.ID) - if err != nil { - ctx.Error(500, "GetOrgUsersByOrgID", err) - return - } - - memberIDs := make([]int64, 0, len(orgUsers)) - for _, orgUser := range orgUsers { - if orgUser.IsPublic { - memberIDs = append(memberIDs, orgUser.UID) - } - } - - if members, err = models.GetUsersByIDs(memberIDs); err != nil { - ctx.Error(500, "GetUsersByIDs", err) - return - } - } else { - if err := ctx.Org.Organization.GetMembers(); err != nil { - ctx.Error(500, "GetMembers", err) - return - } - members = ctx.Org.Organization.Members + members, _, err := models.FindOrgMembers(models.FindOrgMembersOpts{ + OrgID: ctx.Org.Organization.ID, + PublicOnly: publicOnly, + }) + if err != nil { + ctx.Error(500, "GetUsersByIDs", err) + return } apiMembers := make([]*api.User, len(members)) |