summaryrefslogtreecommitdiff
path: root/app/models/issue.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-02-12 21:08:48 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-02-12 21:08:48 +0000
commit006e89697dd5165f355afc20fc6bb0cdfa7b381a (patch)
tree9095aeb37b2c80f3b0cc5a8dfd27baf93f05b61b /app/models/issue.rb
parent43e3dc2f95a25c600e08f65d4f1c406a1a63ed3d (diff)
downloadgitlab-ce-006e89697dd5165f355afc20fc6bb0cdfa7b381a.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/issue.rb')
-rw-r--r--app/models/issue.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/app/models/issue.rb b/app/models/issue.rb
index fd4a8c90386..684108b1a7a 100644
--- a/app/models/issue.rb
+++ b/app/models/issue.rb
@@ -172,8 +172,10 @@ class Issue < ApplicationRecord
end
end
- def self.order_by_position_and_priority
- order_labels_priority
+ # `with_cte` argument allows sorting when using CTE queries and prevents
+ # errors in postgres when using CTE search optimisation
+ def self.order_by_position_and_priority(with_cte: false)
+ order_labels_priority(with_cte: with_cte)
.reorder(Gitlab::Database.nulls_last_order('relative_position', 'ASC'),
Gitlab::Database.nulls_last_order('highest_priority', 'ASC'),
"id DESC")