summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorValery Sizov <valery@gitlab.com>2017-03-07 18:04:44 +0200
committerValery Sizov <valery@gitlab.com>2017-03-14 18:13:52 +0200
commit29e34c332687be9456578a9b5f60adb10f4e10b5 (patch)
tree6704de41870b61b493bff7abd52e62be6b01cd3b /app/models
parent8f66751179bf97d92fa0b9e85fd5336b40f990ea (diff)
downloadgitlab-ce-29e34c332687be9456578a9b5f60adb10f4e10b5.tar.gz
Preserve order by priority on issues boardpreserve_order_issue_board
Diffstat (limited to 'app/models')
-rw-r--r--app/models/issue.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/app/models/issue.rb b/app/models/issue.rb
index 0f7a26ee3e1..dba9398a43c 100644
--- a/app/models/issue.rb
+++ b/app/models/issue.rb
@@ -96,6 +96,13 @@ class Issue < ActiveRecord::Base
end
end
+ def self.order_by_position_and_priority
+ order_labels_priority.
+ reorder(Gitlab::Database.nulls_last_order('relative_position', 'ASC'),
+ Gitlab::Database.nulls_last_order('highest_priority', 'ASC'),
+ "id DESC")
+ end
+
# `from` argument can be a Namespace or Project.
def to_reference(from = nil, full: false)
reference = "#{self.class.reference_prefix}#{iid}"