Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean McGivern <sean@gitlab.com>2017-03-10 14:10:48 +0300
committerSean McGivern <sean@gitlab.com>2017-03-15 20:02:37 +0300
commit101fddfa9203fbcc96151e880a3a1241338a91f2 (patch)
treecd4df611aebd5cd594da22eaefaad73eb190ab1b /app/models/todo.rb
parent6619772f2a7a12fcef86ce530e45705bbbf09dcc (diff)
Allow sorting by due date and label priority
Diffstat (limited to 'app/models/todo.rb')
-rw-r--r--app/models/todo.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/app/models/todo.rb b/app/models/todo.rb
index 47789a21133..da3fa7277c2 100644
--- a/app/models/todo.rb
+++ b/app/models/todo.rb
@@ -48,8 +48,14 @@ class Todo < ActiveRecord::Base
after_save :keep_around_commit
class << self
+ # Priority sorting isn't displayed in the dropdown, because we don't show
+ # milestones, but still show something if the user has a URL with that
+ # selected.
def sort(method)
- method == "priority" ? order_by_labels_priority : order_by(method)
+ case method.to_s
+ when 'priority', 'label_priority' then order_by_labels_priority
+ else order_by(method)
+ end
end
# Order by priority depending on which issue/merge request the Todo belongs to