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/milestone.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/milestone.go')
-rw-r--r-- | routers/repo/milestone.go | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/routers/repo/milestone.go b/routers/repo/milestone.go index a9beed75d7..2dc8366f0d 100644 --- a/routers/repo/milestone.go +++ b/routers/repo/milestone.go @@ -5,6 +5,7 @@ package repo import ( + "net/http" "time" "code.gitea.io/gitea/models" @@ -95,7 +96,7 @@ func Milestones(ctx *context.Context) { pager.AddParam(ctx, "state", "State") ctx.Data["Page"] = pager - ctx.HTML(200, tplMilestone) + ctx.HTML(http.StatusOK, tplMilestone) } // NewMilestone render creating milestone page @@ -103,7 +104,7 @@ func NewMilestone(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("repo.milestones.new") ctx.Data["PageIsIssueList"] = true ctx.Data["PageIsMilestones"] = true - ctx.HTML(200, tplMilestoneNew) + ctx.HTML(http.StatusOK, tplMilestoneNew) } // NewMilestonePost response for creating milestone @@ -114,7 +115,7 @@ func NewMilestonePost(ctx *context.Context) { ctx.Data["PageIsMilestones"] = true if ctx.HasError() { - ctx.HTML(200, tplMilestoneNew) + ctx.HTML(http.StatusOK, tplMilestoneNew) return } @@ -163,7 +164,7 @@ func EditMilestone(ctx *context.Context) { if len(m.DeadlineString) > 0 { ctx.Data["deadline"] = m.DeadlineString } - ctx.HTML(200, tplMilestoneNew) + ctx.HTML(http.StatusOK, tplMilestoneNew) } // EditMilestonePost response for edting milestone @@ -174,7 +175,7 @@ func EditMilestonePost(ctx *context.Context) { ctx.Data["PageIsEditMilestone"] = true if ctx.HasError() { - ctx.HTML(200, tplMilestoneNew) + ctx.HTML(http.StatusOK, tplMilestoneNew) return } @@ -242,7 +243,7 @@ func DeleteMilestone(ctx *context.Context) { ctx.Flash.Success(ctx.Tr("repo.milestones.deletion_success")) } - ctx.JSON(200, map[string]interface{}{ + ctx.JSON(http.StatusOK, map[string]interface{}{ "redirect": ctx.Repo.RepoLink + "/milestones", }) } @@ -272,5 +273,5 @@ func MilestoneIssuesAndPulls(ctx *context.Context) { ctx.Data["CanWriteIssues"] = ctx.Repo.CanWriteIssuesOrPulls(false) ctx.Data["CanWritePulls"] = ctx.Repo.CanWriteIssuesOrPulls(true) - ctx.HTML(200, tplMilestoneIssues) + ctx.HTML(http.StatusOK, tplMilestoneIssues) } |