diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2018-01-18 20:21:41 +0300 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2018-01-22 22:39:03 +0300 |
commit | b3e3e75bfa65f45d766aa7e5c3e02d38afa1bae9 (patch) | |
tree | dc337b0f812935f9f1874433541305196ce567a7 /app | |
parent | 722d89068ec33a4678b333cfd950212602b59c0d (diff) |
Merge branch 'issue_37143_2' into 'master'
Remove unnecessary query from labels dropdown
Closes #37143
See merge request gitlab-org/gitlab-ce!16520
Diffstat (limited to 'app')
-rw-r--r-- | app/finders/labels_finder.rb | 2 | ||||
-rw-r--r-- | app/helpers/issuables_helper.rb | 6 | ||||
-rw-r--r-- | app/views/shared/issuable/_filter.html.haml | 2 |
3 files changed, 8 insertions, 2 deletions
diff --git a/app/finders/labels_finder.rb b/app/finders/labels_finder.rb index 6de9eb89468..1427cdaa382 100644 --- a/app/finders/labels_finder.rb +++ b/app/finders/labels_finder.rb @@ -71,7 +71,7 @@ class LabelsFinder < UnionFinder end def projects? - params[:project_ids].present? + params[:project_ids] end def only_group_labels? diff --git a/app/helpers/issuables_helper.rb b/app/helpers/issuables_helper.rb index 2668cf78afe..520a875238c 100644 --- a/app/helpers/issuables_helper.rb +++ b/app/helpers/issuables_helper.rb @@ -304,6 +304,12 @@ module IssuablesHelper issuable.model_name.human.downcase end + def selected_labels + Array(params[:label_name]).map do |label_name| + Label.new(title: label_name) + end + end + private def sidebar_gutter_collapsed? diff --git a/app/views/shared/issuable/_filter.html.haml b/app/views/shared/issuable/_filter.html.haml index 8442d7ff4a2..7704c88905b 100644 --- a/app/views/shared/issuable/_filter.html.haml +++ b/app/views/shared/issuable/_filter.html.haml @@ -22,7 +22,7 @@ = render "shared/issuable/milestone_dropdown", selected: finder.milestones.try(:first), name: :milestone_title, show_any: true, show_upcoming: true, show_started: true .filter-item.inline.labels-filter - = render "shared/issuable/label_dropdown", selected: finder.labels.select(:title).uniq, use_id: false, selected_toggle: params[:label_name], data_options: { field_name: "label_name[]" } + = render "shared/issuable/label_dropdown", selected: selected_labels, use_id: false, selected_toggle: params[:label_name], data_options: { field_name: "label_name[]" } - if issuable_filter_present? .filter-item.inline.reset-filters |