|
|
@ -18,7 +18,7 @@ import ( |
|
|
|
// ToApiUser converts user to API format.
|
|
|
|
// ToApiUser converts user to API format.
|
|
|
|
func ToApiUser(u *models.User) *api.User { |
|
|
|
func ToApiUser(u *models.User) *api.User { |
|
|
|
return &api.User{ |
|
|
|
return &api.User{ |
|
|
|
Id: u.Id, |
|
|
|
ID: u.Id, |
|
|
|
UserName: u.Name, |
|
|
|
UserName: u.Name, |
|
|
|
AvatarUrl: string(setting.Protocol) + u.AvatarLink(), |
|
|
|
AvatarUrl: string(setting.Protocol) + u.AvatarLink(), |
|
|
|
} |
|
|
|
} |
|
|
@ -45,10 +45,14 @@ func SearchUsers(ctx *middleware.Context) { |
|
|
|
results := make([]*api.User, len(us)) |
|
|
|
results := make([]*api.User, len(us)) |
|
|
|
for i := range us { |
|
|
|
for i := range us { |
|
|
|
results[i] = &api.User{ |
|
|
|
results[i] = &api.User{ |
|
|
|
|
|
|
|
ID: us[i].Id, |
|
|
|
UserName: us[i].Name, |
|
|
|
UserName: us[i].Name, |
|
|
|
AvatarUrl: us[i].AvatarLink(), |
|
|
|
AvatarUrl: us[i].AvatarLink(), |
|
|
|
FullName: us[i].FullName, |
|
|
|
FullName: us[i].FullName, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if ctx.IsSigned { |
|
|
|
|
|
|
|
results[i].Email = us[i].Email |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
ctx.Render.JSON(200, map[string]interface{}{ |
|
|
|
ctx.Render.JSON(200, map[string]interface{}{ |
|
|
|