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
5e10b611
Commit
5e10b611
authored
Apr 01, 2019
by
Antoine Huret
Committed by
Sean McGivern
Apr 01, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add a uniq constraints on issues and mrs labels
parent
e5aa2d88
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
1 deletion
+30
-1
app/services/issuable_base_service.rb
app/services/issuable_base_service.rb
+1
-1
changelogs/unreleased/53210-add-uniq-constraints-on-issues-and-mrs-labels.yml
...d/53210-add-uniq-constraints-on-issues-and-mrs-labels.yml
+5
-0
spec/services/issues/create_service_spec.rb
spec/services/issues/create_service_spec.rb
+14
-0
spec/services/issues/update_service_spec.rb
spec/services/issues/update_service_spec.rb
+10
-0
No files found.
app/services/issuable_base_service.rb
View file @
5e10b611
...
...
@@ -113,7 +113,7 @@ class IssuableBaseService < BaseService
new_label_ids
-=
remove_label_ids
if
remove_label_ids
end
new_label_ids
new_label_ids
.
uniq
end
def
available_labels
...
...
changelogs/unreleased/53210-add-uniq-constraints-on-issues-and-mrs-labels.yml
0 → 100644
View file @
5e10b611
---
title
:
add a uniq constraints on issues and mrs labels
merge_request
:
25435
author
:
Antoine Huret
type
:
fixed
spec/services/issues/create_service_spec.rb
View file @
5e10b611
...
...
@@ -138,6 +138,20 @@ describe Issues::CreateService do
end
end
context
'when duplicate label titles are given'
do
let
(
:label
)
{
create
(
:label
,
project:
project
)
}
let
(
:opts
)
do
{
title:
'Title'
,
description:
'Description'
,
labels:
[
label
.
title
,
label
.
title
]
}
end
it
'assigns the label once'
do
expect
(
issue
.
labels
).
to
contain_exactly
(
label
)
end
end
it
'executes issue hooks when issue is not confidential'
do
opts
=
{
title:
'Title'
,
description:
'Description'
,
confidential:
false
}
...
...
spec/services/issues/update_service_spec.rb
View file @
5e10b611
...
...
@@ -592,6 +592,16 @@ describe Issues::UpdateService, :mailer do
expect
(
result
.
label_ids
).
not_to
include
(
label
.
id
)
end
end
context
'when duplicate label titles are given'
do
let
(
:params
)
do
{
labels:
[
label3
.
title
,
label3
.
title
]
}
end
it
'assigns the label once'
do
expect
(
result
.
labels
).
to
contain_exactly
(
label3
)
end
end
end
context
'updating asssignee_id'
do
...
...
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