From 837116875efc8f27265e884499ecca69ef554014 Mon Sep 17 00:00:00 2001 From: zeripath Date: Mon, 15 Apr 2019 17:36:59 +0100 Subject: Return a UserList from /api/v1/admin/users (#6629) --- routers/api/v1/admin/user.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'routers/api/v1/admin') diff --git a/routers/api/v1/admin/user.go b/routers/api/v1/admin/user.go index 2e2a7fecb9..609b53874e 100644 --- a/routers/api/v1/admin/user.go +++ b/routers/api/v1/admin/user.go @@ -10,6 +10,7 @@ import ( "code.gitea.io/gitea/modules/context" "code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/setting" + "code.gitea.io/gitea/routers/api/v1/convert" "code.gitea.io/gitea/routers/api/v1/user" api "code.gitea.io/sdk/gitea" ) @@ -319,8 +320,14 @@ func GetAllUsers(ctx *context.APIContext) { PageSize: -1, }) if err != nil { - ctx.Error(500, "SearchUsers", err) + ctx.Error(500, "GetAllUsers", err) return } - ctx.JSON(200, &users) + + results := make([]*api.User, len(users)) + for i := range users { + results[i] = convert.ToUser(users[i], ctx.IsSigned, ctx.User.IsAdmin) + } + + ctx.JSON(200, &results) } -- cgit v1.2.3