diff options
author | Phil Hughes <me@iamphill.com> | 2016-09-05 17:32:07 +0100 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2016-09-07 09:14:30 +0100 |
commit | f849ef792a620164d1e1e231b58f72f17293e9fc (patch) | |
tree | cfcd8b9e00a5c2e3a1394950ab7967da0ee6a242 | |
parent | 1e042ac251119c5e3b0ef8e76f3a6d9420fba98b (diff) | |
download | gitlab-ce-f849ef792a620164d1e1e231b58f72f17293e9fc.tar.gz |
Fixed issue board label filtering not removing labels
Closes #21417
-rw-r--r-- | CHANGELOG | 1 | ||||
-rw-r--r-- | app/assets/javascripts/labels_select.js | 6 | ||||
-rw-r--r-- | spec/features/boards/boards_spec.rb | 19 |
3 files changed, 23 insertions, 3 deletions
diff --git a/CHANGELOG b/CHANGELOG index 17388615908..8e85ef8bbed 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -37,6 +37,7 @@ v 8.12.0 (unreleased) - Use 'git update-ref' for safer web commits !6130 - Automatically expand hidden discussions when accessed by a permalink !5585 (Mike Greiling) - Remove unused mixins (ClemMakesApps) + - Fix issue board label filtering appending already filtered labels - Add search to all issue board lists - Fix groups sort dropdown alignment (ClemMakesApps) - Add horizontal scrolling to all sub-navs on mobile viewports (ClemMakesApps) diff --git a/app/assets/javascripts/labels_select.js b/app/assets/javascripts/labels_select.js index bab23ff5ac0..5f84e0f1024 100644 --- a/app/assets/javascripts/labels_select.js +++ b/app/assets/javascripts/labels_select.js @@ -273,12 +273,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 c6c2e2095df..c697dbea131 100644 --- a/spec/features/boards/boards_spec.rb +++ b/spec/features/boards/boards_spec.rb @@ -467,6 +467,25 @@ describe 'Issue Boards', feature: true, js: true do end end + it 'removes filtered labels' do + page.within '.labels-filter' do + click_button('Label') + wait_for_ajax + + page.within '.dropdown-menu-labels' do + click_link(testing.title) + end + + expect(page).to have_css('input[name="label_name[]"]', visible: false) + + page.within '.dropdown-menu-labels' do + click_link(testing.title) + 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]) |