summaryrefslogtreecommitdiff
path: root/app/models/milestone.rb
diff options
context:
space:
mode:
authorDouglas Barbosa Alexandre <dbalexandre@gmail.com>2018-07-27 14:02:54 -0300
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2018-07-30 11:01:55 -0300
commit16c8a030fc339b4d86e5e46b0d9c6394ff978d83 (patch)
tree3b5074f167f1570ec49cfb8b83592051b07cf8cf /app/models/milestone.rb
parent3d2dad449da2915b2c431bf32548e03b08fcbe40 (diff)
downloadgitlab-ce-16c8a030fc339b4d86e5e46b0d9c6394ff978d83.tar.gz
Fix ordering by name on milestones page
We should sort by title because name is only an alias for the title attribute on the milestone model.
Diffstat (limited to 'app/models/milestone.rb')
-rw-r--r--app/models/milestone.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/app/models/milestone.rb b/app/models/milestone.rb
index 14cc12b38a5..d0f7f9c3593 100644
--- a/app/models/milestone.rb
+++ b/app/models/milestone.rb
@@ -149,6 +149,10 @@ class Milestone < ActiveRecord::Base
reorder(Gitlab::Database.nulls_last_order('due_date', 'ASC'))
when 'due_date_desc'
reorder(Gitlab::Database.nulls_last_order('due_date', 'DESC'))
+ when 'name_asc'
+ reorder(Arel::Nodes::Ascending.new(arel_table[:title].lower))
+ when 'name_desc'
+ reorder(Arel::Nodes::Descending.new(arel_table[:title].lower))
when 'start_date_asc'
reorder(Gitlab::Database.nulls_last_order('start_date', 'ASC'))
when 'start_date_desc'