aboutsummaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
Diffstat (limited to 'models')
-rw-r--r--models/issue.go2
-rw-r--r--models/issue_test.go2
2 files changed, 2 insertions, 2 deletions
diff --git a/models/issue.go b/models/issue.go
index b517f334c4..7731a59ed0 100644
--- a/models/issue.go
+++ b/models/issue.go
@@ -1682,7 +1682,7 @@ func SearchIssueIDsByKeyword(kw string, repoIDs []int64, limit, start int) (int6
)
var ids = make([]int64, 0, limit)
- err := x.Distinct("id").Table("issue").Where(cond).Limit(limit, start).Find(&ids)
+ err := x.Distinct("id").Table("issue").Where(cond).OrderBy("`updated_unix` DESC").Limit(limit, start).Find(&ids)
if err != nil {
return 0, nil, err
}
diff --git a/models/issue_test.go b/models/issue_test.go
index 1f65cb433a..8fbc49a46d 100644
--- a/models/issue_test.go
+++ b/models/issue_test.go
@@ -299,7 +299,7 @@ func TestIssue_SearchIssueIDsByKeyword(t *testing.T) {
total, ids, err = SearchIssueIDsByKeyword("for", []int64{1}, 10, 0)
assert.NoError(t, err)
assert.EqualValues(t, 5, total)
- assert.EqualValues(t, []int64{1, 2, 3, 5, 11}, ids)
+ assert.ElementsMatch(t, []int64{1, 2, 3, 5, 11}, ids)
// issue1's comment id 2
total, ids, err = SearchIssueIDsByKeyword("good", []int64{1}, 10, 0)