Skip to content

Commit

Permalink
[API] List limited and private orgs if authentificated (#16866)
Browse files Browse the repository at this point in the history
* fix bug #16785 and similar

* code format

* CI.restart()
  • Loading branch information
6543 committed Aug 30, 2021
1 parent 06b9d55 commit 73394f4
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
1 change: 1 addition & 0 deletions routers/api/v1/admin/org.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ func GetAllOrgs(ctx *context.APIContext) {
listOptions := utils.GetListOptions(ctx)

users, maxResults, err := models.SearchUsers(&models.SearchUserOptions{
Actor: ctx.User,
Type: models.UserTypeOrganization,
OrderBy: models.SearchOrderByAlphabetically,
ListOptions: listOptions,
Expand Down
1 change: 1 addition & 0 deletions routers/api/v1/org/org.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ func GetAll(ctx *context.APIContext) {
listOptions := utils.GetListOptions(ctx)

publicOrgs, maxResults, err := models.SearchUsers(&models.SearchUserOptions{
Actor: ctx.User,
ListOptions: listOptions,
Type: models.UserTypeOrganization,
OrderBy: models.SearchOrderByAlphabetically,
Expand Down
6 changes: 2 additions & 4 deletions routers/api/v1/user/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,13 @@ func Search(ctx *context.APIContext) {

listOptions := utils.GetListOptions(ctx)

opts := &models.SearchUserOptions{
users, maxResults, err := models.SearchUsers(&models.SearchUserOptions{
Actor: ctx.User,
Keyword: ctx.FormTrim("q"),
UID: ctx.FormInt64("uid"),
Type: models.UserTypeIndividual,
ListOptions: listOptions,
}

users, maxResults, err := models.SearchUsers(opts)
})
if err != nil {
ctx.JSON(http.StatusInternalServerError, map[string]interface{}{
"ok": false,
Expand Down

0 comments on commit 73394f4

Please sign in to comment.