diff options
author | 6543 <6543@obermui.de> | 2020-12-02 22:38:30 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-02 22:38:30 +0100 |
commit | 7ac8a770e1086a50d1fc0a194fe0d7060036fb30 (patch) | |
tree | f3c9e4e92bd158c8ef506ea46163c2dd95a57cfa /routers/api/v1/user | |
parent | Migrations: Use Process Manager to create own Context (#13792) (diff) | |
download | forgejo-7ac8a770e1086a50d1fc0a194fe0d7060036fb30.tar.xz forgejo-7ac8a770e1086a50d1fc0a194fe0d7060036fb30.zip |
Move Repo APIFormat to convert package (#13787)
* Move Repo APIFormat to convert package
* tweek
Diffstat (limited to 'routers/api/v1/user')
-rw-r--r-- | routers/api/v1/user/repo.go | 5 | ||||
-rw-r--r-- | routers/api/v1/user/star.go | 3 | ||||
-rw-r--r-- | routers/api/v1/user/watch.go | 3 |
3 files changed, 7 insertions, 4 deletions
diff --git a/routers/api/v1/user/repo.go b/routers/api/v1/user/repo.go index ae5e319c27..b17841e67a 100644 --- a/routers/api/v1/user/repo.go +++ b/routers/api/v1/user/repo.go @@ -10,6 +10,7 @@ import ( "code.gitea.io/gitea/models" "code.gitea.io/gitea/modules/context" + "code.gitea.io/gitea/modules/convert" api "code.gitea.io/gitea/modules/structs" "code.gitea.io/gitea/routers/api/v1/utils" ) @@ -37,7 +38,7 @@ func listUserRepos(ctx *context.APIContext, u *models.User, private bool) { return } if ctx.IsSigned && ctx.User.IsAdmin || access >= models.AccessModeRead { - apiRepos = append(apiRepos, repos[i].APIFormat(access)) + apiRepos = append(apiRepos, convert.ToRepo(repos[i], access)) } } @@ -125,7 +126,7 @@ func ListMyRepos(ctx *context.APIContext) { if err != nil { ctx.Error(http.StatusInternalServerError, "AccessLevel", err) } - results[i] = repo.APIFormat(accessMode) + results[i] = convert.ToRepo(repo, accessMode) } ctx.SetLinkHeader(int(count), opts.ListOptions.PageSize) diff --git a/routers/api/v1/user/star.go b/routers/api/v1/user/star.go index 1fc1005810..937dcb477f 100644 --- a/routers/api/v1/user/star.go +++ b/routers/api/v1/user/star.go @@ -10,6 +10,7 @@ import ( "code.gitea.io/gitea/models" "code.gitea.io/gitea/modules/context" + "code.gitea.io/gitea/modules/convert" api "code.gitea.io/gitea/modules/structs" "code.gitea.io/gitea/routers/api/v1/utils" ) @@ -28,7 +29,7 @@ func getStarredRepos(user *models.User, private bool, listOptions models.ListOpt if err != nil { return nil, err } - repos[i] = starred.APIFormat(access) + repos[i] = convert.ToRepo(starred, access) } return repos, nil } diff --git a/routers/api/v1/user/watch.go b/routers/api/v1/user/watch.go index 9ad8682f5f..ab656f3229 100644 --- a/routers/api/v1/user/watch.go +++ b/routers/api/v1/user/watch.go @@ -9,6 +9,7 @@ import ( "code.gitea.io/gitea/models" "code.gitea.io/gitea/modules/context" + "code.gitea.io/gitea/modules/convert" api "code.gitea.io/gitea/modules/structs" "code.gitea.io/gitea/routers/api/v1/utils" ) @@ -27,7 +28,7 @@ func getWatchedRepos(user *models.User, private bool, listOptions models.ListOpt if err != nil { return nil, err } - repos[i] = watched.APIFormat(access) + repos[i] = convert.ToRepo(watched, access) } return repos, nil } |