diff options
author | Fatih Acet <acetfatih@gmail.com> | 2016-09-27 14:08:45 +0000 |
---|---|---|
committer | Fatih Acet <acetfatih@gmail.com> | 2016-09-27 14:08:45 +0000 |
commit | 3820ca5876ecb550d4d7eba0db98296f467125d8 (patch) | |
tree | 613977d866fd51375c6582a31d6726ae24931c29 | |
parent | bc452eafea8dfd32ea1b132c04fc22a38fa71d5c (diff) | |
parent | 78839ec0fe146564a4a4a2ab339f479e25a13e5e (diff) | |
download | gitlab-ce-3820ca5876ecb550d4d7eba0db98296f467125d8.tar.gz |
Merge branch 'issue-boards-label-filter-fix' into 'master'
Fixed issue board label filtering not removing labels
## What does this MR do?
When trying to remove a label filter it would actually add it instead making it impossible to remove the label filter without modifying the URL. This fixes that by correctly removing the label from the filter.
## What are the relevant issue numbers?
Closes #21417
See merge request !6208
-rw-r--r-- | CHANGELOG | 1 | ||||
-rw-r--r-- | app/assets/javascripts/labels_select.js | 6 | ||||
-rw-r--r-- | spec/features/boards/boards_spec.rb | 23 |
3 files changed, 27 insertions, 3 deletions
diff --git a/CHANGELOG b/CHANGELOG index 2f3fe4703d4..28c5d23d604 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -118,6 +118,7 @@ v 8.12.0 - Change pipeline duration to be jobs running time instead of simple wall time from start to end !6084 - Show queued time when showing a pipeline !6084 - Remove unused mixins (ClemMakesApps) + - Fix issue board label filtering appending already filtered labels - Add search to all issue board lists - Scroll active tab into view on mobile - Fix groups sort dropdown alignment (ClemMakesApps) diff --git a/app/assets/javascripts/labels_select.js b/app/assets/javascripts/labels_select.js index 3f15a117ca8..c562b7d7b00 100644 --- a/app/assets/javascripts/labels_select.js +++ b/app/assets/javascripts/labels_select.js @@ -280,12 +280,12 @@ if (page === 'projects:boards:show') { if (label.isAny) { gl.issueBoards.BoardsStore.state.filters['label_name'] = []; - } else if (label.title) { + } else if ($el.hasClass('is-active')) { gl.issueBoards.BoardsStore.state.filters['label_name'].push(label.title); } else { var filters = gl.issueBoards.BoardsStore.state.filters['label_name']; - filters = filters.filter(function (label) { - return label !== $el.text().trim(); + filters = filters.filter(function (filteredLabel) { + return filteredLabel !== label.title; }); gl.issueBoards.BoardsStore.state.filters['label_name'] = filters; } diff --git a/spec/features/boards/boards_spec.rb b/spec/features/boards/boards_spec.rb index 2dcbc4703e1..26ea06e002b 100644 --- a/spec/features/boards/boards_spec.rb +++ b/spec/features/boards/boards_spec.rb @@ -466,6 +466,29 @@ describe 'Issue Boards', feature: true, js: true do end end + it 'removes filtered labels' do + wait_for_vue_resource + + page.within '.labels-filter' do + click_button('Label') + wait_for_ajax + + page.within '.dropdown-menu-labels' do + click_link(testing.title) + wait_for_vue_resource(spinner: false) + end + + expect(page).to have_css('input[name="label_name[]"]', visible: false) + + page.within '.dropdown-menu-labels' do + click_link(testing.title) + wait_for_vue_resource(spinner: false) + end + + expect(page).not_to have_css('input[name="label_name[]"]', visible: false) + end + end + it 'infinite scrolls list with label filter' do 50.times do create(:labeled_issue, project: project, labels: [testing]) |