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
cece77f2
Commit
cece77f2
authored
Oct 13, 2016
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix validation to allow updates to description/color of project label
parent
fc59d357
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
1 deletion
+11
-1
app/models/project_label.rb
app/models/project_label.rb
+1
-1
spec/models/project_label_spec.rb
spec/models/project_label_spec.rb
+10
-0
No files found.
app/models/project_label.rb
View file @
cece77f2
...
@@ -14,7 +14,7 @@ class ProjectLabel < Label
...
@@ -14,7 +14,7 @@ class ProjectLabel < Label
private
private
def
title_must_not_exist_at_group_level
def
title_must_not_exist_at_group_level
return
unless
group
.
present?
return
unless
group
.
present?
&&
title_changed?
if
group
.
labels
.
with_title
(
self
.
title
).
exists?
if
group
.
labels
.
with_title
(
self
.
title
).
exists?
errors
.
add
(
:title
,
:label_already_exists_at_group_level
,
group:
group
.
name
)
errors
.
add
(
:title
,
:label_already_exists_at_group_level
,
group:
group
.
name
)
...
...
spec/models/project_label_spec.rb
View file @
cece77f2
...
@@ -40,6 +40,16 @@ describe ProjectLabel, models: true do
...
@@ -40,6 +40,16 @@ describe ProjectLabel, models: true do
expect
(
label
.
errors
[
:title
]).
to
be_empty
expect
(
label
.
errors
[
:title
]).
to
be_empty
end
end
it
'does not returns error when title does not change'
do
project_label
=
create
(
:label
,
project:
project
,
name:
'Security'
)
create
(
:group_label
,
group:
group
,
name:
'Security'
)
project_label
.
description
=
'Security related stuff.'
project_label
.
valid?
expect
(
project_label
.
errors
[
:title
]).
to
be_empty
end
end
end
end
end
...
...
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