Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix link-action redirect network error #27734

Merged
merged 9 commits into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions routers/web/repo/milestone.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,14 +231,15 @@ func EditMilestonePost(ctx *context.Context) {

// ChangeMilestoneStatus response for change a milestone's status
func ChangeMilestoneStatus(ctx *context.Context) {
toClose := false
var toClose bool
switch ctx.Params(":action") {
case "open":
toClose = false
case "close":
toClose = true
default:
ctx.Redirect(ctx.Repo.RepoLink + "/milestones")
ctx.JSONRedirect(ctx.Repo.RepoLink + "/milestones")
return
}
id := ctx.ParamsInt64(":id")

Expand All @@ -250,7 +251,7 @@ func ChangeMilestoneStatus(ctx *context.Context) {
}
return
}
ctx.Redirect(ctx.Repo.RepoLink + "/milestones?state=" + url.QueryEscape(ctx.Params(":action")))
ctx.JSONRedirect(ctx.Repo.RepoLink + "/milestones?state=" + url.QueryEscape(ctx.Params(":action")))
}

// DeleteMilestone delete a milestone
Expand Down
7 changes: 4 additions & 3 deletions routers/web/repo/projects.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,14 +161,15 @@ func NewProjectPost(ctx *context.Context) {

// ChangeProjectStatus updates the status of a project between "open" and "close"
func ChangeProjectStatus(ctx *context.Context) {
toClose := false
var toClose bool
switch ctx.Params(":action") {
case "open":
toClose = false
case "close":
toClose = true
default:
ctx.Redirect(ctx.Repo.RepoLink + "/projects")
ctx.JSONRedirect(ctx.Repo.RepoLink + "/projects")
return
}
id := ctx.ParamsInt64(":id")

Expand All @@ -180,7 +181,7 @@ func ChangeProjectStatus(ctx *context.Context) {
}
return
}
ctx.Redirect(ctx.Repo.RepoLink + "/projects?state=" + url.QueryEscape(ctx.Params(":action")))
ctx.JSONRedirect(ctx.Repo.RepoLink + "/projects?state=" + url.QueryEscape(ctx.Params(":action")))
}

// DeleteProject delete a project
Expand Down