From 73238f8be6825e8f512a69159b188aea0c6486cc Mon Sep 17 00:00:00 2001 From: Zettat123 Date: Thu, 8 Jun 2023 16:08:35 +0800 Subject: [PATCH] Fix `MilestoneIDs` when querying issues (#25125) Fix #25114 --- routers/web/repo/issue.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/routers/web/repo/issue.go b/routers/web/repo/issue.go index cbb2e20314489..5ab8db2e057fe 100644 --- a/routers/web/repo/issue.go +++ b/routers/web/repo/issue.go @@ -202,6 +202,11 @@ func issues(ctx *context.Context, milestoneID, projectID int64, isPullOption uti } } + var mileIDs []int64 + if milestoneID > 0 || milestoneID == db.NoConditionID { // -1 to get those issues which have no any milestone assigned + mileIDs = []int64{milestoneID} + } + var issueStats *issues_model.IssueStats if forceEmpty { issueStats = &issues_model.IssueStats{} @@ -209,7 +214,7 @@ func issues(ctx *context.Context, milestoneID, projectID int64, isPullOption uti issueStats, err = issues_model.GetIssueStats(&issues_model.IssuesOptions{ RepoIDs: []int64{repo.ID}, LabelIDs: labelIDs, - MilestoneIDs: []int64{milestoneID}, + MilestoneIDs: mileIDs, ProjectID: projectID, AssigneeID: assigneeID, MentionedID: mentionedID, @@ -244,11 +249,6 @@ func issues(ctx *context.Context, milestoneID, projectID int64, isPullOption uti } pager := context.NewPagination(total, setting.UI.IssuePagingNum, page, 5) - var mileIDs []int64 - if milestoneID > 0 || milestoneID == db.NoConditionID { // -1 to get those issues which have no any milestone assigned - mileIDs = []int64{milestoneID} - } - var issues []*issues_model.Issue if forceEmpty { issues = []*issues_model.Issue{}