From dca375aad22b2d1c88d1f8fed20e4865e51ee333 Mon Sep 17 00:00:00 2001 From: confusedsushi Date: Sat, 30 Aug 2025 04:05:18 +0200 Subject: [PATCH] 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 --- models/issues/issue_search.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/models/issues/issue_search.go b/models/issues/issue_search.go index 79bd6a19b0d..466e788d6c4 100644 --- a/models/issues/issue_search.go +++ b/models/issues/issue_search.go @@ -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 " +