summaryrefslogtreecommitdiffstats
path: root/models/issue.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2022-06-05 03:18:50 +0800
committerGitHub <noreply@github.com>2022-06-04 20:18:50 +0100
commit12c742f8dc25e4148c44d1265d119c35f161bf74 (patch)
tree0c35f1de4cf7bdea1dfc8b03468f3616d0c82796 /models/issue.go
parent449ea6005fb613212102126ff267f5c16f7c40b8 (diff)
downloadgitea-12c742f8dc25e4148c44d1265d119c35f161bf74.tar.gz
gitea-12c742f8dc25e4148c44d1265d119c35f161bf74.zip
Fix order by parameter (#19849)
Upgrade builder to v0.3.11 Upgrade xorm to v1.3.1 and fixed some hidden bugs. Replace #19821 Replace #19834 Included #19850 Co-authored-by: zeripath <art27@cantab.net>
Diffstat (limited to 'models/issue.go')
-rw-r--r--models/issue.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/models/issue.go b/models/issue.go
index 1a66e5e95b..4150d66a65 100644
--- a/models/issue.go
+++ b/models/issue.go
@@ -1220,9 +1220,9 @@ func sortIssuesSession(sess *xorm.Session, sortType string, priorityRepoID int64
Desc("issue.created_unix").
Desc("issue.id")
case "priorityrepo":
- sess.OrderBy("CASE " +
- "WHEN issue.repo_id = " + strconv.FormatInt(priorityRepoID, 10) + " THEN 1 " +
- "ELSE 2 END ASC").
+ sess.OrderBy("CASE "+
+ "WHEN issue.repo_id = ? THEN 1 "+
+ "ELSE 2 END ASC", priorityRepoID).
Desc("issue.created_unix").
Desc("issue.id")
case "project-column-sorting":
@@ -2124,7 +2124,7 @@ func (issue *Issue) BlockedByDependencies(ctx context.Context) (issueDeps []*Dep
Join("INNER", "issue_dependency", "issue_dependency.dependency_id = issue.id").
Where("issue_id = ?", issue.ID).
// sort by repo id then created date, with the issues of the same repo at the beginning of the list
- OrderBy("CASE WHEN issue.repo_id = " + strconv.FormatInt(issue.RepoID, 10) + " THEN 0 ELSE issue.repo_id END, issue.created_unix DESC").
+ OrderBy("CASE WHEN issue.repo_id = ? THEN 0 ELSE issue.repo_id END, issue.created_unix DESC", issue.RepoID).
Find(&issueDeps)
for _, depInfo := range issueDeps {
@@ -2142,7 +2142,7 @@ func (issue *Issue) BlockingDependencies(ctx context.Context) (issueDeps []*Depe
Join("INNER", "issue_dependency", "issue_dependency.issue_id = issue.id").
Where("dependency_id = ?", issue.ID).
// sort by repo id then created date, with the issues of the same repo at the beginning of the list
- OrderBy("CASE WHEN issue.repo_id = " + strconv.FormatInt(issue.RepoID, 10) + " THEN 0 ELSE issue.repo_id END, issue.created_unix DESC").
+ OrderBy("CASE WHEN issue.repo_id = ? THEN 0 ELSE issue.repo_id END, issue.created_unix DESC", issue.RepoID).
Find(&issueDeps)
for _, depInfo := range issueDeps {