Skip to content

Commit 5d92d6c

Browse files
committed
Make /users/search return a UserList
Signed-off-by: Andrew Thornton <[email protected]>
1 parent d293a2b commit 5d92d6c

File tree

2 files changed

+3
-9
lines changed

2 files changed

+3
-9
lines changed

public/js/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1459,7 +1459,7 @@ function searchUsers() {
14591459
url: suburl + '/api/v1/users/search?q={query}',
14601460
onResponse: function(response) {
14611461
var items = [];
1462-
$.each(response.data, function (i, item) {
1462+
$.each(response, function (i, item) {
14631463
var title = item.login;
14641464
if (item.full_name && item.full_name.length > 0) {
14651465
title += ' (' + item.full_name + ')';

routers/api/v1/user/user.go

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,7 @@ func Search(ctx *context.APIContext) {
4545

4646
users, _, err := models.SearchUsers(opts)
4747
if err != nil {
48-
ctx.JSON(500, map[string]interface{}{
49-
"ok": false,
50-
"error": err.Error(),
51-
})
48+
ctx.Error(500, "UserSearch", err)
5249
return
5350
}
5451

@@ -65,10 +62,7 @@ func Search(ctx *context.APIContext) {
6562
}
6663
}
6764

68-
ctx.JSON(200, map[string]interface{}{
69-
"ok": true,
70-
"data": results,
71-
})
65+
ctx.JSON(200, results)
7266
}
7367

7468
// GetInfo get user's information

0 commit comments

Comments
 (0)