summaryrefslogtreecommitdiffstats
path: root/routers/api/v1/user/user.go
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2019-04-15 17:36:59 +0100
committertechknowlogick <matti@mdranta.net>2019-04-15 12:36:59 -0400
commit837116875efc8f27265e884499ecca69ef554014 (patch)
tree78f6b246216be0f98ac32c3e2b35b831cd840eac /routers/api/v1/user/user.go
parent74fc63682c4c14b5c19c46f9d41af1cf4212766f (diff)
downloadgitea-837116875efc8f27265e884499ecca69ef554014.tar.gz
gitea-837116875efc8f27265e884499ecca69ef554014.zip
Return a UserList from /api/v1/admin/users (#6629)
Diffstat (limited to 'routers/api/v1/user/user.go')
-rw-r--r--routers/api/v1/user/user.go13
1 files changed, 2 insertions, 11 deletions
diff --git a/routers/api/v1/user/user.go b/routers/api/v1/user/user.go
index 0f10c4e814..2e4ae273e5 100644
--- a/routers/api/v1/user/user.go
+++ b/routers/api/v1/user/user.go
@@ -10,7 +10,7 @@ import (
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/context"
- "code.gitea.io/gitea/modules/markup"
+ "code.gitea.io/gitea/routers/api/v1/convert"
api "code.gitea.io/sdk/gitea"
"github.com/Unknwon/com"
@@ -67,16 +67,7 @@ func Search(ctx *context.APIContext) {
results := make([]*api.User, len(users))
for i := range users {
- results[i] = &api.User{
- ID: users[i].ID,
- UserName: users[i].Name,
- AvatarURL: users[i].AvatarLink(),
- FullName: markup.Sanitize(users[i].FullName),
- IsAdmin: users[i].IsAdmin,
- }
- if ctx.IsSigned && (!users[i].KeepEmailPrivate || ctx.User.IsAdmin) {
- results[i].Email = users[i].Email
- }
+ results[i] = convert.ToUser(users[i], ctx.IsSigned, ctx.User.IsAdmin)
}
ctx.JSON(200, map[string]interface{}{