mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-27 12:53:57 +01:00
minor fix on API response
This commit is contained in:
parent
47ac579f09
commit
54b52de6ee
2 changed files with 7 additions and 2 deletions
|
@ -222,7 +222,8 @@ func runWeb(ctx *cli.Context) {
|
|||
m.Get("", v1.GetUserInfo)
|
||||
|
||||
m.Group("/tokens", func() {
|
||||
m.Combo("").Get(v1.ListAccessTokens).Post(bind(v1.CreateAccessTokenForm{}), v1.CreateAccessToken)
|
||||
m.Combo("").Get(v1.ListAccessTokens).
|
||||
Post(bind(v1.CreateAccessTokenForm{}), v1.CreateAccessToken)
|
||||
}, middleware.ApiReqBasicAuth())
|
||||
})
|
||||
})
|
||||
|
|
|
@ -18,7 +18,7 @@ import (
|
|||
// ToApiUser converts user to API format.
|
||||
func ToApiUser(u *models.User) *api.User {
|
||||
return &api.User{
|
||||
Id: u.Id,
|
||||
ID: u.Id,
|
||||
UserName: u.Name,
|
||||
AvatarUrl: string(setting.Protocol) + u.AvatarLink(),
|
||||
}
|
||||
|
@ -45,10 +45,14 @@ func SearchUsers(ctx *middleware.Context) {
|
|||
results := make([]*api.User, len(us))
|
||||
for i := range us {
|
||||
results[i] = &api.User{
|
||||
ID: us[i].Id,
|
||||
UserName: us[i].Name,
|
||||
AvatarUrl: us[i].AvatarLink(),
|
||||
FullName: us[i].FullName,
|
||||
}
|
||||
if ctx.IsSigned {
|
||||
results[i].Email = us[i].Email
|
||||
}
|
||||
}
|
||||
|
||||
ctx.Render.JSON(200, map[string]interface{}{
|
||||
|
|
Loading…
Reference in a new issue