0
0
mirror of https://github.com/go-gitea/gitea.git synced 2026-04-04 01:24:56 +02:00

Merge 4666bc17e453bef4d676e151fecd79392b51ff16 into 30c07c20e94551141cc1873ab14bdd4c104bba94

This commit is contained in:
Lunny Xiao 2026-04-03 10:28:23 +02:00 committed by GitHub
commit c06a9caccf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View File

@ -71,7 +71,7 @@ func (opts FindMilestoneOptions) ToConds() builder.Cond {
func (opts FindMilestoneOptions) ToOrders() string {
switch opts.SortType {
case "furthestduedate":
return "deadline_unix DESC"
return "CASE WHEN deadline_unix = 0 OR deadline_unix IS NULL THEN 0 ELSE 1 END, deadline_unix DESC, name ASC"
case "leastcomplete":
return "completeness ASC"
case "mostcomplete":
@ -85,7 +85,7 @@ func (opts FindMilestoneOptions) ToOrders() string {
case "name":
return "name DESC"
default:
return "deadline_unix ASC, name ASC"
return "CASE WHEN deadline_unix = 0 OR deadline_unix IS NULL THEN 1 ELSE 0 END, deadline_unix ASC, name ASC"
}
}

View File

@ -67,7 +67,7 @@ func TestAPIIssuesMilestone(t *testing.T) {
resp = MakeRequest(t, req, http.StatusOK)
DecodeJSON(t, resp, &apiMilestones)
assert.Len(t, apiMilestones, 4)
assert.Nil(t, apiMilestones[0].Deadline)
assert.Nil(t, apiMilestones[3].Deadline)
req = NewRequest(t, "GET", fmt.Sprintf("/api/v1/repos/%s/%s/milestones/%s", owner.Name, repo.Name, apiMilestones[2].Title)).
AddTokenAuth(token)