List limited and private orgs if authenticated on API (#16866) (#16879)

This commit is contained in:
6543 2021-08-31 12:49:02 +02:00 committed by GitHub
parent af1fd56d8a
commit 3ac1f35349
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 4 deletions

View file

@ -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,

View file

@ -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,

View file

@ -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,