Template
1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo synced 2024-11-29 13:16:10 +01:00

Fix MilestoneIDs when querying issues (#25125) (#25141)

Backport #25125 by @Zettat123

Fix #25114

Co-authored-by: Zettat123 <zettat123@gmail.com>
This commit is contained in:
Giteabot 2023-06-08 05:03:53 -04:00 committed by GitHub
parent eac1bddb8d
commit 1cc63ade82
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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 var issueStats *issues_model.IssueStats
if forceEmpty { if forceEmpty {
issueStats = &issues_model.IssueStats{} 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{ issueStats, err = issues_model.GetIssueStats(&issues_model.IssuesOptions{
RepoIDs: []int64{repo.ID}, RepoIDs: []int64{repo.ID},
LabelIDs: labelIDs, LabelIDs: labelIDs,
MilestoneIDs: []int64{milestoneID}, MilestoneIDs: mileIDs,
ProjectID: projectID, ProjectID: projectID,
AssigneeID: assigneeID, AssigneeID: assigneeID,
MentionedID: mentionedID, 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) 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 var issues []*issues_model.Issue
if forceEmpty { if forceEmpty {
issues = []*issues_model.Issue{} issues = []*issues_model.Issue{}