summaryrefslogtreecommitdiffstats
path: root/routers/api/v1/user
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2016-08-14 04:17:26 -0700
committerUnknwon <u@gogs.io>2016-08-14 04:17:26 -0700
commitdccb0c15b996ac4dc0307cbfed140ce1558d7e3c (patch)
tree97593eae3a1023296c2c03258e6bc4ae4c02b6bf /routers/api/v1/user
parent3f7f4852efaaa56a0dada832dc652a1fc8869ae7 (diff)
downloadgitea-dccb0c15b996ac4dc0307cbfed140ce1558d7e3c.tar.gz
gitea-dccb0c15b996ac4dc0307cbfed140ce1558d7e3c.zip
Replace convert.To with APIFormat calls
Diffstat (limited to 'routers/api/v1/user')
-rw-r--r--routers/api/v1/user/follower.go3
-rw-r--r--routers/api/v1/user/user.go5
2 files changed, 3 insertions, 5 deletions
diff --git a/routers/api/v1/user/follower.go b/routers/api/v1/user/follower.go
index 8d103c9e14..58a162444b 100644
--- a/routers/api/v1/user/follower.go
+++ b/routers/api/v1/user/follower.go
@@ -9,13 +9,12 @@ import (
"github.com/gogits/gogs/models"
"github.com/gogits/gogs/modules/context"
- "github.com/gogits/gogs/routers/api/v1/convert"
)
func responseApiUsers(ctx *context.APIContext, users []*models.User) {
apiUsers := make([]*api.User, len(users))
for i := range users {
- apiUsers[i] = convert.ToUser(users[i])
+ apiUsers[i] = users[i].APIFormat()
}
ctx.JSON(200, &apiUsers)
}
diff --git a/routers/api/v1/user/user.go b/routers/api/v1/user/user.go
index 87a9c08623..b526af5da7 100644
--- a/routers/api/v1/user/user.go
+++ b/routers/api/v1/user/user.go
@@ -11,7 +11,6 @@ import (
"github.com/gogits/gogs/models"
"github.com/gogits/gogs/modules/context"
- "github.com/gogits/gogs/routers/api/v1/convert"
)
func Search(ctx *context.APIContext) {
@@ -67,9 +66,9 @@ func GetInfo(ctx *context.APIContext) {
if !ctx.IsSigned {
u.Email = ""
}
- ctx.JSON(200, convert.ToUser(u))
+ ctx.JSON(200, u.APIFormat())
}
func GetAuthenticatedUser(ctx *context.APIContext) {
- ctx.JSON(200, convert.ToUser(ctx.User))
+ ctx.JSON(200, ctx.User.APIFormat())
}