diff --git a/routers/api/v1/admin/org.go b/routers/api/v1/admin/org.go index 1356276f07..d20c17fed3 100644 --- a/routers/api/v1/admin/org.go +++ b/routers/api/v1/admin/org.go @@ -106,6 +106,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, diff --git a/routers/api/v1/org/org.go b/routers/api/v1/org/org.go index 5c16594f89..860fec77cd 100644 --- a/routers/api/v1/org/org.go +++ b/routers/api/v1/org/org.go @@ -130,6 +130,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, diff --git a/routers/api/v1/user/user.go b/routers/api/v1/user/user.go index ac543d597d..4ca0fc2439 100644 --- a/routers/api/v1/user/user.go +++ b/routers/api/v1/user/user.go @@ -56,15 +56,13 @@ func Search(ctx *context.APIContext) { listOptions := utils.GetListOptions(ctx) - opts := &models.SearchUserOptions{ + users, maxResults, err := models.SearchUsers(&models.SearchUserOptions{ Actor: ctx.User, Keyword: strings.Trim(ctx.Query("q"), " "), UID: ctx.QueryInt64("uid"), Type: models.UserTypeIndividual, ListOptions: listOptions, - } - - users, maxResults, err := models.SearchUsers(opts) + }) if err != nil { ctx.JSON(http.StatusInternalServerError, map[string]interface{}{ "ok": false,