Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
86054dcc
Commit
86054dcc
authored
Oct 09, 2019
by
Rajat Jain
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Scoped labels do not remove old label in board sidebar
parent
7c6e27fa
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
0 deletions
+50
-0
app/assets/javascripts/labels_select.js
app/assets/javascripts/labels_select.js
+14
-0
ee/changelogs/unreleased/rjain-remove-old-label.yml
ee/changelogs/unreleased/rjain-remove-old-label.yml
+5
-0
spec/features/boards/sidebar_spec.rb
spec/features/boards/sidebar_spec.rb
+31
-0
No files found.
app/assets/javascripts/labels_select.js
View file @
86054dcc
...
...
@@ -32,6 +32,7 @@ export default class LabelsSelect {
$selectbox
,
$sidebarCollapsedValue
,
$value
,
$dropdownMenu
,
abilityName
,
defaultLabel
,
issueUpdateURL
,
...
...
@@ -67,6 +68,7 @@ export default class LabelsSelect {
$sidebarCollapsedValue
=
$block
.
find
(
'
.sidebar-collapsed-icon span
'
);
$sidebarLabelTooltip
=
$block
.
find
(
'
.js-sidebar-labels-tooltip
'
);
$value
=
$block
.
find
(
'
.value
'
);
$dropdownMenu
=
$dropdown
.
parent
().
find
(
'
.dropdown-menu
'
);
$loading
=
$block
.
find
(
'
.block-loading
'
).
fadeOut
();
fieldName
=
$dropdown
.
data
(
'
fieldName
'
);
initialSelected
=
$selectbox
...
...
@@ -454,9 +456,21 @@ export default class LabelsSelect {
}
$loading
.
fadeIn
();
const
oldLabels
=
boardsStore
.
detail
.
issue
.
labels
;
boardsStore
.
detail
.
issue
.
update
(
$dropdown
.
attr
(
'
data-issue-update
'
))
.
then
(()
=>
{
if
(
isScopedLabel
(
label
))
{
const
prevIds
=
oldLabels
.
map
(
label
=>
label
.
id
);
const
newIds
=
boardsStore
.
detail
.
issue
.
labels
.
map
(
label
=>
label
.
id
);
const
differentIds
=
_
.
difference
(
prevIds
,
newIds
);
$dropdown
.
data
(
'
marked
'
,
newIds
);
$dropdownMenu
.
find
(
differentIds
.
map
(
id
=>
`[data-label-id="
${
id
}
"]`
).
join
(
'
,
'
))
.
removeClass
(
'
is-active
'
);
}
})
.
then
(
fadeOutLoader
)
.
catch
(
fadeOutLoader
);
}
else
if
(
handleClick
)
{
...
...
ee/changelogs/unreleased/rjain-remove-old-label.yml
0 → 100644
View file @
86054dcc
---
title
:
Scoped labels do not remove old label in board sidebar
merge_request
:
18313
author
:
type
:
fixed
spec/features/boards/sidebar_spec.rb
View file @
86054dcc
...
...
@@ -14,6 +14,8 @@ describe 'Issue Boards', :js do
let!
(
:bug
)
{
create
(
:label
,
project:
project
,
name:
'Bug'
)
}
let!
(
:regression
)
{
create
(
:label
,
project:
project
,
name:
'Regression'
)
}
let!
(
:stretch
)
{
create
(
:label
,
project:
project
,
name:
'Stretch'
)
}
let!
(
:scoped_label_1
)
{
create
(
:label
,
project:
project
,
name:
'Scoped::Label1'
)
}
let!
(
:scoped_label_2
)
{
create
(
:label
,
project:
project
,
name:
'Scoped::Label2'
)
}
let!
(
:issue1
)
{
create
(
:labeled_issue
,
project:
project
,
assignees:
[
user
],
milestone:
milestone
,
labels:
[
development
],
relative_position:
2
)
}
let!
(
:issue2
)
{
create
(
:labeled_issue
,
project:
project
,
labels:
[
development
,
stretch
],
relative_position:
1
)
}
let
(
:board
)
{
create
(
:board
,
project:
project
)
}
...
...
@@ -27,6 +29,8 @@ describe 'Issue Boards', :js do
end
before
do
stub_licensed_features
(
scoped_labels:
true
)
project
.
add_maintainer
(
user
)
sign_in
(
user
)
...
...
@@ -308,6 +312,33 @@ describe 'Issue Boards', :js do
expect
(
card
).
to
have_content
(
bug
.
title
)
end
it
'removes existing scoped label'
do
click_card
(
card
)
page
.
within
(
'.labels'
)
do
click_link
'Edit'
wait_for_requests
click_link
scoped_label_1
.
title
click_link
scoped_label_2
.
title
wait_for_requests
find
(
'.dropdown-menu-close-icon'
).
click
page
.
within
(
'.value'
)
do
expect
(
page
).
to
have_selector
(
'.badge'
,
count:
3
)
expect
(
page
).
not_to
have_content
(
scoped_label_1
.
title
)
expect
(
page
).
to
have_content
(
scoped_label_2
.
title
)
end
end
expect
(
card
).
to
have_selector
(
'.badge'
,
count:
3
)
expect
(
card
).
not_to
have_content
(
scoped_label_1
.
title
)
expect
(
card
).
to
have_content
(
scoped_label_2
.
title
)
end
it
'adds a multiple labels'
do
click_card
(
card
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment