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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
4e9aa7e2
Commit
4e9aa7e2
authored
Jan 03, 2019
by
Robert Schilling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Correctly search for labels in parent groups
parent
22d2a480
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
+6
-6
lib/api/group_labels.rb
lib/api/group_labels.rb
+2
-2
lib/api/helpers.rb
lib/api/helpers.rb
+4
-4
No files found.
lib/api/group_labels.rb
View file @
4e9aa7e2
...
@@ -57,7 +57,7 @@ module API
...
@@ -57,7 +57,7 @@ module API
delete
':id/labels'
do
delete
':id/labels'
do
authorize!
:admin_label
,
user_group
authorize!
:admin_label
,
user_group
label
=
find_label
(
user_group
,
params
[
:name
])
label
=
find_label
(
user_group
,
params
[
:name
]
,
false
)
destroy_conditionally!
(
label
)
destroy_conditionally!
(
label
)
end
end
...
@@ -76,7 +76,7 @@ module API
...
@@ -76,7 +76,7 @@ module API
put
':id/labels'
do
put
':id/labels'
do
authorize!
:admin_label
,
user_group
authorize!
:admin_label
,
user_group
label
=
find_label
(
user_group
,
params
[
:name
])
label
=
find_label
(
user_group
,
params
[
:name
]
,
false
)
label
=
::
Labels
::
UpdateService
.
new
(
declared_params
(
include_missing:
false
)).
execute
(
label
)
label
=
::
Labels
::
UpdateService
.
new
(
declared_params
(
include_missing:
false
)).
execute
(
label
)
render_validation_error!
(
label
)
unless
label
.
valid?
render_validation_error!
(
label
)
unless
label
.
valid?
...
...
lib/api/helpers.rb
View file @
4e9aa7e2
...
@@ -84,8 +84,8 @@ module API
...
@@ -84,8 +84,8 @@ module API
page
||
not_found!
(
'Wiki Page'
)
page
||
not_found!
(
'Wiki Page'
)
end
end
def
available_labels_for
(
label_parent
,
search_params
=
{}
)
def
available_labels_for
(
label_parent
,
include_ancestor_groups
=
true
)
search_params
.
merge
(
include_ancestor_groups:
true
)
search_params
=
{
include_ancestor_groups:
include_ancestor_groups
}
if
label_parent
.
is_a?
(
Project
)
if
label_parent
.
is_a?
(
Project
)
search_params
[
:project_id
]
=
label_parent
.
id
search_params
[
:project_id
]
=
label_parent
.
id
...
@@ -170,8 +170,8 @@ module API
...
@@ -170,8 +170,8 @@ module API
end
end
end
end
def
find_label
(
parent
,
id
)
def
find_label
(
parent
,
id
,
include_ancestor_groups
=
true
)
labels
=
available_labels_for
(
parent
)
labels
=
available_labels_for
(
parent
,
include_ancestor_groups
)
label
=
labels
.
find_by_id
(
id
)
||
labels
.
find_by_title
(
id
)
label
=
labels
.
find_by_id
(
id
)
||
labels
.
find_by_title
(
id
)
label
||
not_found!
(
'Label'
)
label
||
not_found!
(
'Label'
)
...
...
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