diff options
author | 6543 <6543@obermui.de> | 2020-01-12 16:43:44 +0100 |
---|---|---|
committer | Lunny Xiao <xiaolunwen@gmail.com> | 2020-01-12 23:43:44 +0800 |
commit | 10055bd2b1d18d3ccbec78cbc213e459ddb75804 (patch) | |
tree | 0c3aacafab3f852a0509c4dcd2055aa93e36c0c3 /routers/home.go | |
parent | 497e15fdc28518ab03e2f1114fb112b8c0630e18 (diff) | |
download | gitea-10055bd2b1d18d3ccbec78cbc213e459ddb75804.tar.gz gitea-10055bd2b1d18d3ccbec78cbc213e459ddb75804.zip |
[API] add GET /orgs endpoint (#9560)
* introduce `GET /orgs`
* add TEST
* show also other VisibleType's
* update description
* refactor a lot
* SearchUserOptions by default return only public
Diffstat (limited to 'routers/home.go')
-rw-r--r-- | routers/home.go | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/routers/home.go b/routers/home.go index 773e0f3d6b..0f59c95705 100644 --- a/routers/home.go +++ b/routers/home.go @@ -15,6 +15,7 @@ import ( code_indexer "code.gitea.io/gitea/modules/indexer/code" "code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/setting" + "code.gitea.io/gitea/modules/structs" "code.gitea.io/gitea/modules/util" "code.gitea.io/gitea/routers/user" ) @@ -249,7 +250,7 @@ func ExploreUsers(ctx *context.Context) { Type: models.UserTypeIndividual, PageSize: setting.UI.ExplorePagingNum, IsActive: util.OptionalBoolTrue, - Private: true, + Visible: []structs.VisibleType{structs.VisibleTypePublic, structs.VisibleTypeLimited, structs.VisibleTypePrivate}, }, tplExploreUsers) } @@ -265,12 +266,17 @@ func ExploreOrganizations(ctx *context.Context) { ownerID = ctx.User.ID } - RenderUserSearch(ctx, &models.SearchUserOptions{ + opts := models.SearchUserOptions{ Type: models.UserTypeOrganization, PageSize: setting.UI.ExplorePagingNum, - Private: ctx.User != nil, OwnerID: ownerID, - }, tplExploreOrganizations) + } + if ctx.User != nil { + opts.Visible = []structs.VisibleType{structs.VisibleTypePublic, structs.VisibleTypeLimited, structs.VisibleTypePrivate} + } else { + opts.Visible = []structs.VisibleType{structs.VisibleTypePublic} + } + RenderUserSearch(ctx, &opts, tplExploreOrganizations) } // ExploreCode render explore code page |