diff options
author | Unknwon <u@gogs.io> | 2016-08-14 04:17:26 -0700 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2016-08-14 04:17:26 -0700 |
commit | dccb0c15b996ac4dc0307cbfed140ce1558d7e3c (patch) | |
tree | 97593eae3a1023296c2c03258e6bc4ae4c02b6bf /routers/api/v1/repo/repo.go | |
parent | 3f7f4852efaaa56a0dada832dc652a1fc8869ae7 (diff) | |
download | gitea-dccb0c15b996ac4dc0307cbfed140ce1558d7e3c.tar.gz gitea-dccb0c15b996ac4dc0307cbfed140ce1558d7e3c.zip |
Replace convert.To with APIFormat calls
Diffstat (limited to 'routers/api/v1/repo/repo.go')
-rw-r--r-- | routers/api/v1/repo/repo.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/routers/api/v1/repo/repo.go b/routers/api/v1/repo/repo.go index e1c1b5760d..cc75f5bf4e 100644 --- a/routers/api/v1/repo/repo.go +++ b/routers/api/v1/repo/repo.go @@ -93,12 +93,12 @@ func ListMyRepos(ctx *context.APIContext) { repos := make([]*api.Repository, numOwnRepos+len(accessibleRepos)) for i := range ownRepos { - repos[i] = convert.ToRepository(ctx.User, ownRepos[i], api.Permission{true, true, true}) + repos[i] = ownRepos[i].APIFormat(&api.Permission{true, true, true}) } i := numOwnRepos for repo, access := range accessibleRepos { - repos[i] = convert.ToRepository(repo.Owner, repo, api.Permission{ + repos[i] = repo.APIFormat(&api.Permission{ Admin: access >= models.ACCESS_MODE_ADMIN, Push: access >= models.ACCESS_MODE_WRITE, Pull: true, @@ -135,7 +135,7 @@ func CreateUserRepo(ctx *context.APIContext, owner *models.User, opt api.CreateR return } - ctx.JSON(201, convert.ToRepository(owner, repo, api.Permission{true, true, true})) + ctx.JSON(201, repo.APIFormat(&api.Permission{true, true, true})) } // https://github.com/gogits/go-gogs-client/wiki/Repositories#create @@ -235,7 +235,7 @@ func Migrate(ctx *context.APIContext, form auth.MigrateRepoForm) { } log.Trace("Repository migrated: %s/%s", ctxUser.Name, form.RepoName) - ctx.JSON(201, convert.ToRepository(ctxUser, repo, api.Permission{true, true, true})) + ctx.JSON(201, repo.APIFormat(&api.Permission{true, true, true})) } func parseOwnerAndRepo(ctx *context.APIContext) (*models.User, *models.Repository) { @@ -264,12 +264,12 @@ func parseOwnerAndRepo(ctx *context.APIContext) (*models.User, *models.Repositor // https://github.com/gogits/go-gogs-client/wiki/Repositories#get func Get(ctx *context.APIContext) { - owner, repo := parseOwnerAndRepo(ctx) + _, repo := parseOwnerAndRepo(ctx) if ctx.Written() { return } - ctx.JSON(200, convert.ToRepository(owner, repo, api.Permission{true, true, true})) + ctx.JSON(200, repo.APIFormat(&api.Permission{true, true, true})) } // https://github.com/gogits/go-gogs-client/wiki/Repositories#delete |