From 5b46907304e93998744a20a0dd4ab2b06510ccde Mon Sep 17 00:00:00 2001 From: ychao_1983 Date: Thu, 16 Dec 2021 11:21:58 +0800 Subject: [PATCH] =?UTF-8?q?fix-646=E5=90=8E=E7=AB=AF=E9=83=A8=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- models/issue.go | 2 ++ routers/repo/issue.go | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/models/issue.go b/models/issue.go index 7457fcd45..19f00d5f3 100755 --- a/models/issue.go +++ b/models/issue.go @@ -1397,6 +1397,8 @@ func getIssueStatsChunk(opts *IssueStatsOptions, issueIDs []int64) (*IssueStats, if opts.MilestoneID > 0 { sess.And("issue.milestone_id = ?", opts.MilestoneID) + } else if opts.MilestoneID == -1 { //only search for issues do not have milestone + sess.And("issue.milestone_id = ?", 0) } if opts.AssigneeID > 0 { diff --git a/routers/repo/issue.go b/routers/repo/issue.go index 77ed0251d..7aa8151da 100755 --- a/routers/repo/issue.go +++ b/routers/repo/issue.go @@ -193,6 +193,8 @@ func issues(ctx *context.Context, milestoneID int64, isPullOption util.OptionalB var mileIDs []int64 if milestoneID > 0 { mileIDs = []int64{milestoneID} + } else if milestoneID == -1 { //only search no milestone + mileIDs = []int64{0} } var issues []*models.Issue @@ -355,7 +357,7 @@ func Issues(ctx *context.Context) { var err error // Get milestones. - ctx.Data["Milestones"], err = models.GetMilestonesByRepoID(ctx.Repo.Repository.ID, api.StateType(ctx.Query("state")), models.ListOptions{}) + ctx.Data["Milestones"], err = models.GetMilestonesByRepoID(ctx.Repo.Repository.ID, api.StateAll, models.ListOptions{}) if err != nil { ctx.ServerError("GetAllRepoMilestones", err) return