diff options
author | Valery Sizov <valery@gitlab.com> | 2017-03-07 18:04:44 +0200 |
---|---|---|
committer | Valery Sizov <valery@gitlab.com> | 2017-03-14 18:13:52 +0200 |
commit | 29e34c332687be9456578a9b5f60adb10f4e10b5 (patch) | |
tree | 6704de41870b61b493bff7abd52e62be6b01cd3b /app | |
parent | 8f66751179bf97d92fa0b9e85fd5336b40f990ea (diff) | |
download | gitlab-ce-29e34c332687be9456578a9b5f60adb10f4e10b5.tar.gz |
Preserve order by priority on issues boardpreserve_order_issue_board
Diffstat (limited to 'app')
-rw-r--r-- | app/models/issue.rb | 7 | ||||
-rw-r--r-- | app/services/boards/issues/list_service.rb | 2 |
2 files changed, 8 insertions, 1 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}" diff --git a/app/services/boards/issues/list_service.rb b/app/services/boards/issues/list_service.rb index 185838764c1..83f51947bd4 100644 --- a/app/services/boards/issues/list_service.rb +++ b/app/services/boards/issues/list_service.rb @@ -5,7 +5,7 @@ module Boards issues = IssuesFinder.new(current_user, filter_params).execute issues = without_board_labels(issues) unless movable_list? issues = with_list_label(issues) if movable_list? - issues.reorder(Gitlab::Database.nulls_last_order('relative_position', 'ASC')) + issues.order_by_position_and_priority end private |