diff options
author | Thijs Wouters <thijs@morewood.be> | 2016-03-14 12:46:26 +0300 |
---|---|---|
committer | Alfredo Sumaran <alfredo@gitlab.com> | 2016-06-06 19:59:49 +0300 |
commit | d8263b285193d9163089683eb77825f1cd673b14 (patch) | |
tree | 4ecdabc6af9a09556fdb212488d381b43d20ae10 /app/finders | |
parent | 0e2f26dd2a10ed876f96b0496dff2de6780eeaea (diff) |
Sort by label priority
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'app/finders')
-rw-r--r-- | app/finders/issuable_finder.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/app/finders/issuable_finder.rb b/app/finders/issuable_finder.rb index 7d8c56f4c22..68ab6e87684 100644 --- a/app/finders/issuable_finder.rb +++ b/app/finders/issuable_finder.rb @@ -224,7 +224,7 @@ class IssuableFinder def sort(items) # Ensure we always have an explicit sort order (instead of inheriting # multiple orders when combining ActiveRecord::Relation objects). - params[:sort] ? items.sort(params[:sort]) : items.reorder(id: :desc) + params[:sort] ? items.sort(params[:sort], label_names) : items.reorder(id: :desc) end def by_assignee(items) @@ -318,7 +318,11 @@ class IssuableFinder end def label_names - params[:label_name].is_a?(String) ? params[:label_name].split(',') : params[:label_name] + if labels? + params[:label_name].is_a?(String) ? params[:label_name].split(',') : params[:label_name] + else + [] + end end def current_user_related? |