From adfef7d2d824c4a367be4a08f11b4f62a995c671 Mon Sep 17 00:00:00 2001 From: lng2020 Date: Sun, 22 Oct 2023 12:51:53 +0800 Subject: [PATCH 1/8] some small fixs --- models/issues/issue_search.go | 2 +- routers/web/repo/projects.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/models/issues/issue_search.go b/models/issues/issue_search.go index 9b6bf117b1f84..0bea1fed143b0 100644 --- a/models/issues/issue_search.go +++ b/models/issues/issue_search.go @@ -186,7 +186,7 @@ func applyProjectBoardCondition(sess *xorm.Session, opts *IssuesOptions) *xorm.S if opts.ProjectBoardID > 0 { sess.In("issue.id", builder.Select("issue_id").From("project_issue").Where(builder.Eq{"project_board_id": opts.ProjectBoardID})) } else if opts.ProjectBoardID == db.NoConditionID { - sess.In("issue.id", builder.Select("issue_id").From("project_issue").Where(builder.Neq{"project_board_id": 0})) + sess.In("issue.id", builder.Select("issue_id").From("project_issue").Where(builder.Eq{"project_board_id": 0})) } return sess } diff --git a/routers/web/repo/projects.go b/routers/web/repo/projects.go index ada398fdc8e9c..c22b6fa906197 100644 --- a/routers/web/repo/projects.go +++ b/routers/web/repo/projects.go @@ -180,7 +180,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 From afa28899538f38e86fcc0d9dbedc3d634f5cbd27 Mon Sep 17 00:00:00 2001 From: lng2020 Date: Sun, 22 Oct 2023 15:29:55 +0800 Subject: [PATCH 2/8] revert some change --- models/issues/issue_search.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/issues/issue_search.go b/models/issues/issue_search.go index 0bea1fed143b0..9b6bf117b1f84 100644 --- a/models/issues/issue_search.go +++ b/models/issues/issue_search.go @@ -186,7 +186,7 @@ func applyProjectBoardCondition(sess *xorm.Session, opts *IssuesOptions) *xorm.S if opts.ProjectBoardID > 0 { sess.In("issue.id", builder.Select("issue_id").From("project_issue").Where(builder.Eq{"project_board_id": opts.ProjectBoardID})) } else if opts.ProjectBoardID == db.NoConditionID { - sess.In("issue.id", builder.Select("issue_id").From("project_issue").Where(builder.Eq{"project_board_id": 0})) + sess.In("issue.id", builder.Select("issue_id").From("project_issue").Where(builder.Neq{"project_board_id": 0})) } return sess } From 954584b3334929fd8bd81f8ba3ce7ce8e9779689 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Sun, 22 Oct 2023 14:38:38 +0200 Subject: [PATCH 3/8] return --- routers/web/repo/projects.go | 1 + 1 file changed, 1 insertion(+) diff --git a/routers/web/repo/projects.go b/routers/web/repo/projects.go index c22b6fa906197..63c5c98af93fd 100644 --- a/routers/web/repo/projects.go +++ b/routers/web/repo/projects.go @@ -169,6 +169,7 @@ func ChangeProjectStatus(ctx *context.Context) { toClose = true default: ctx.Redirect(ctx.Repo.RepoLink + "/projects") + return } id := ctx.ParamsInt64(":id") From eee57a34e01b3ec602a18739443e6f9db42b99b4 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Sun, 22 Oct 2023 15:20:39 +0200 Subject: [PATCH 4/8] please linter --- routers/web/repo/projects.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routers/web/repo/projects.go b/routers/web/repo/projects.go index 63c5c98af93fd..abded2ee7d87c 100644 --- a/routers/web/repo/projects.go +++ b/routers/web/repo/projects.go @@ -161,7 +161,7 @@ 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 From 11380cf4bd90a9b499d05a6ae3da0c296bd0ac79 Mon Sep 17 00:00:00 2001 From: Nanguan Lin <70063547+lng2020@users.noreply.github.com> Date: Sun, 22 Oct 2023 22:44:33 +0800 Subject: [PATCH 5/8] Update projects.go --- routers/web/repo/projects.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routers/web/repo/projects.go b/routers/web/repo/projects.go index abded2ee7d87c..6417024f8ba3c 100644 --- a/routers/web/repo/projects.go +++ b/routers/web/repo/projects.go @@ -168,7 +168,7 @@ func ChangeProjectStatus(ctx *context.Context) { case "close": toClose = true default: - ctx.Redirect(ctx.Repo.RepoLink + "/projects") + ctx.JSONRedirect(ctx.Repo.RepoLink + "/projects") return } id := ctx.ParamsInt64(":id") From 7c0a2ceef72bb1219c479a7493d14b1c6f7644f8 Mon Sep 17 00:00:00 2001 From: lng2020 Date: Mon, 23 Oct 2023 14:03:05 +0800 Subject: [PATCH 6/8] fix milestone --- routers/web/repo/milestone.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/routers/web/repo/milestone.go b/routers/web/repo/milestone.go index 4db02fce9ea4f..7381a949627f2 100644 --- a/routers/web/repo/milestone.go +++ b/routers/web/repo/milestone.go @@ -231,14 +231,14 @@ 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.JSON(ctx.Repo.RepoLink + "/milestones") } id := ctx.ParamsInt64(":id") @@ -250,7 +250,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 From 49eb1ea1538b59e266ebdfaa015e901687976b81 Mon Sep 17 00:00:00 2001 From: lng2020 Date: Mon, 23 Oct 2023 14:04:35 +0800 Subject: [PATCH 7/8] fix milestone --- routers/web/repo/milestone.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routers/web/repo/milestone.go b/routers/web/repo/milestone.go index 7381a949627f2..a34ab48995f00 100644 --- a/routers/web/repo/milestone.go +++ b/routers/web/repo/milestone.go @@ -238,7 +238,7 @@ func ChangeMilestoneStatus(ctx *context.Context) { case "close": toClose = true default: - ctx.JSON(ctx.Repo.RepoLink + "/milestones") + ctx.JSONRedirect(ctx.Repo.RepoLink + "/milestones") } id := ctx.ParamsInt64(":id") From 84c8bbb3b44e0638e540b155c612a4c4424a14e9 Mon Sep 17 00:00:00 2001 From: Nanguan Lin <70063547+lng2020@users.noreply.github.com> Date: Mon, 23 Oct 2023 14:06:48 +0800 Subject: [PATCH 8/8] Update milestone.go --- routers/web/repo/milestone.go | 1 + 1 file changed, 1 insertion(+) diff --git a/routers/web/repo/milestone.go b/routers/web/repo/milestone.go index a34ab48995f00..0e6f63074749f 100644 --- a/routers/web/repo/milestone.go +++ b/routers/web/repo/milestone.go @@ -239,6 +239,7 @@ func ChangeMilestoneStatus(ctx *context.Context) { toClose = true default: ctx.JSONRedirect(ctx.Repo.RepoLink + "/milestones") + return } id := ctx.ParamsInt64(":id")