mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Refactor names (#31405)
This PR only does "renaming": * `Route` should be `Router` (and chi router is also called "router") * `Params` should be `PathParam` (to distingush it from URL query param, and to match `FormString`) * Use lower case for private functions to avoid exposing or abusing
This commit is contained in:
@@ -165,7 +165,7 @@ func EditMilestone(ctx *context.Context) {
|
||||
ctx.Data["PageIsMilestones"] = true
|
||||
ctx.Data["PageIsEditMilestone"] = true
|
||||
|
||||
m, err := issues_model.GetMilestoneByRepoID(ctx, ctx.Repo.Repository.ID, ctx.ParamsInt64(":id"))
|
||||
m, err := issues_model.GetMilestoneByRepoID(ctx, ctx.Repo.Repository.ID, ctx.PathParamInt64(":id"))
|
||||
if err != nil {
|
||||
if issues_model.IsErrMilestoneNotExist(err) {
|
||||
ctx.NotFound("", nil)
|
||||
@@ -205,7 +205,7 @@ func EditMilestonePost(ctx *context.Context) {
|
||||
}
|
||||
|
||||
deadline = time.Date(deadline.Year(), deadline.Month(), deadline.Day(), 23, 59, 59, 0, deadline.Location())
|
||||
m, err := issues_model.GetMilestoneByRepoID(ctx, ctx.Repo.Repository.ID, ctx.ParamsInt64(":id"))
|
||||
m, err := issues_model.GetMilestoneByRepoID(ctx, ctx.Repo.Repository.ID, ctx.PathParamInt64(":id"))
|
||||
if err != nil {
|
||||
if issues_model.IsErrMilestoneNotExist(err) {
|
||||
ctx.NotFound("", nil)
|
||||
@@ -229,7 +229,7 @@ func EditMilestonePost(ctx *context.Context) {
|
||||
// ChangeMilestoneStatus response for change a milestone's status
|
||||
func ChangeMilestoneStatus(ctx *context.Context) {
|
||||
var toClose bool
|
||||
switch ctx.Params(":action") {
|
||||
switch ctx.PathParam(":action") {
|
||||
case "open":
|
||||
toClose = false
|
||||
case "close":
|
||||
@@ -238,7 +238,7 @@ func ChangeMilestoneStatus(ctx *context.Context) {
|
||||
ctx.JSONRedirect(ctx.Repo.RepoLink + "/milestones")
|
||||
return
|
||||
}
|
||||
id := ctx.ParamsInt64(":id")
|
||||
id := ctx.PathParamInt64(":id")
|
||||
|
||||
if err := issues_model.ChangeMilestoneStatusByRepoIDAndID(ctx, ctx.Repo.Repository.ID, id, toClose); err != nil {
|
||||
if issues_model.IsErrMilestoneNotExist(err) {
|
||||
@@ -248,7 +248,7 @@ func ChangeMilestoneStatus(ctx *context.Context) {
|
||||
}
|
||||
return
|
||||
}
|
||||
ctx.JSONRedirect(ctx.Repo.RepoLink + "/milestones?state=" + url.QueryEscape(ctx.Params(":action")))
|
||||
ctx.JSONRedirect(ctx.Repo.RepoLink + "/milestones?state=" + url.QueryEscape(ctx.PathParam(":action")))
|
||||
}
|
||||
|
||||
// DeleteMilestone delete a milestone
|
||||
@@ -264,7 +264,7 @@ func DeleteMilestone(ctx *context.Context) {
|
||||
|
||||
// MilestoneIssuesAndPulls lists all the issues and pull requests of the milestone
|
||||
func MilestoneIssuesAndPulls(ctx *context.Context) {
|
||||
milestoneID := ctx.ParamsInt64(":id")
|
||||
milestoneID := ctx.PathParamInt64(":id")
|
||||
projectID := ctx.FormInt64("project")
|
||||
milestone, err := issues_model.GetMilestoneByRepoID(ctx, ctx.Repo.Repository.ID, milestoneID)
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user