when sorting issues by nearest due date, issues without due date should be sorted ascending (#35267)

When sorting issues and pull requests by the nearest due date, the
issues and PRs without a due date are currently sorted _descending_ by
their creation date. This seems counter intuitive to me. When sorting by
nearest due date I want to see the issues/PRs in the order they should
be worked on. For issues/PRs without a due date that order should be
first come first served rather than last come first served.

This PR now changes the ordering of issues/PRs which don't have a due
date to _ascending_ by their creation date. So that the oldest is shown
first and the newest last.

This now also makes the sort order nearest due date a true opposite to
farthest due date. At farthest due date the newest is shown first and
the oldest last.

Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
confusedsushi
2025-08-30 04:05:18 +02:00
committed by GitHub
parent fe7883c54f
commit dca375aad2

View File

@@ -106,8 +106,8 @@ func applySorts(sess *xorm.Session, sortType string, priorityRepoID int64) {
"WHEN milestone.deadline_unix = 0 OR milestone.deadline_unix IS NULL THEN issue.deadline_unix " +
"WHEN milestone.deadline_unix < issue.deadline_unix OR issue.deadline_unix = 0 THEN milestone.deadline_unix " +
"ELSE issue.deadline_unix END ASC").
Desc("issue.created_unix").
Desc("issue.id")
Asc("issue.created_unix").
Asc("issue.id")
case "farduedate":
sess.Join("LEFT", "milestone", "issue.milestone_id = milestone.id").
OrderBy("CASE " +