index
:
gogs.git
Gogs is a painless self-hosted Git service
log msg
author
committer
range
buildscript
main
mygogs
about
summary
refs
log
tree
commit
diff
path:
root
/
routers
/
api
/
v1
/
user.go
diff options
context:
1
2
3
4
5
6
7
8
9
10
15
20
25
30
35
40
space:
include
ignore
mode:
unified
ssdiff
stat only
author
Unknwon <joe2010xtmf@163.com>
2014-12-12 20:30:32 -0500
committer
Unknwon <joe2010xtmf@163.com>
2014-12-12 20:30:32 -0500
commit
ac4a10456ea4515091c3c90a83a82c1e59cdf428
(
patch
)
tree
db68f1f7a8f290322bd4da9892487cca5a1a5843
/
routers/api/v1/user.go
parent
2f3a7e53cb58e922055baf3cf14138100a1f05ac
(
diff
)
api: able to create repo and fix #726
- POST /user/repos - POST /org/:org/repos
Diffstat
(limited to 'routers/api/v1/user.go')
-rw-r--r--
routers/api/v1/user.go
10
1 files changed, 10 insertions, 0 deletions
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"),