diff options
author | 6543 <6543@obermui.de> | 2021-04-05 17:30:52 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-05 11:30:52 -0400 |
commit | 16dea6cebd375fc274fc7a9c216dbcc9e22bd5c7 (patch) | |
tree | 75d47012e9899ca24408aeef7fa3adfcd4beaed1 /routers/repo/view.go | |
parent | e9fba18a26c9d0f8586254a83ef7afcd293a725a (diff) | |
download | gitea-16dea6cebd375fc274fc7a9c216dbcc9e22bd5c7.tar.gz gitea-16dea6cebd375fc274fc7a9c216dbcc9e22bd5c7.zip |
[refactor] replace int with httpStatusCodes (#15282)
* replace "200" (int) with "http.StatusOK" (const)
* ctx.Error & ctx.HTML
* ctx.JSON Part1
* ctx.JSON Part2
* ctx.JSON Part3
Diffstat (limited to 'routers/repo/view.go')
-rw-r--r-- | routers/repo/view.go | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/routers/repo/view.go b/routers/repo/view.go index 39f16d183c..568d9ec6be 100644 --- a/routers/repo/view.go +++ b/routers/repo/view.go @@ -12,6 +12,7 @@ import ( gotemplate "html/template" "io" "io/ioutil" + "net/http" "net/url" "path" "strconv" @@ -582,7 +583,7 @@ func Home(ctx *context.Context) { ctx.Data["Repo"] = ctx.Repo ctx.Data["MigrateTask"] = task ctx.Data["CloneAddr"] = safeURL(cfg.CloneAddr) - ctx.HTML(200, tplMigrating) + ctx.HTML(http.StatusOK, tplMigrating) return } @@ -641,7 +642,7 @@ func renderCode(ctx *context.Context) { ctx.Data["PageIsViewCode"] = true if ctx.Repo.Repository.IsEmpty { - ctx.HTML(200, tplRepoEMPTY) + ctx.HTML(http.StatusOK, tplRepoEMPTY) return } @@ -704,7 +705,7 @@ func renderCode(ctx *context.Context) { ctx.Data["TreeLink"] = treeLink ctx.Data["TreeNames"] = treeNames ctx.Data["BranchLink"] = branchLink - ctx.HTML(200, tplRepoHome) + ctx.HTML(http.StatusOK, tplRepoHome) } // RenderUserCards render a page show users according the input templaet @@ -726,7 +727,7 @@ func RenderUserCards(ctx *context.Context, total int, getter func(opts models.Li } ctx.Data["Cards"] = items - ctx.HTML(200, tpl) + ctx.HTML(http.StatusOK, tpl) } // Watchers render repository's watch users @@ -765,5 +766,5 @@ func Forks(ctx *context.Context) { } ctx.Data["Forks"] = forks - ctx.HTML(200, tplForks) + ctx.HTML(http.StatusOK, tplForks) } |