From ac4a10456ea4515091c3c90a83a82c1e59cdf428 Mon Sep 17 00:00:00 2001 From: Unknwon Date: Fri, 12 Dec 2014 20:30:32 -0500 Subject: api: able to create repo and fix #726 - POST /user/repos - POST /org/:org/repos --- routers/api/v1/user.go | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'routers/api/v1/user.go') diff --git a/routers/api/v1/user.go b/routers/api/v1/user.go index 15c423f7..e9ba615f 100644 --- a/routers/api/v1/user.go +++ b/routers/api/v1/user.go @@ -12,8 +12,18 @@ import ( "github.com/gogits/gogs/models" "github.com/gogits/gogs/modules/base" "github.com/gogits/gogs/modules/middleware" + "github.com/gogits/gogs/modules/setting" ) +// ToApiUser converts user to API format. +func ToApiUser(u *models.User) *api.User { + return &api.User{ + Id: u.Id, + UserName: u.Name, + AvatarUrl: string(setting.Protocol) + u.AvatarLink(), + } +} + func SearchUsers(ctx *middleware.Context) { opt := models.SearchOption{ Keyword: ctx.Query("q"), -- cgit v1.2.3