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
ee826ad4
Commit
ee826ad4
authored
Sep 20, 2018
by
Robert Schilling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace finders
parent
82f09a91
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
+5
-5
lib/api/group_labels.rb
lib/api/group_labels.rb
+3
-3
lib/api/helpers.rb
lib/api/helpers.rb
+2
-2
No files found.
lib/api/group_labels.rb
View file @
ee826ad4
...
...
@@ -35,7 +35,7 @@ module API
post
':id/labels'
do
authorize!
:admin_label
,
user_group
label
=
available_labels_for
(
user_group
).
find_by
(
title:
params
[
:name
]
)
label
=
available_labels_for
(
user_group
,
{
title:
params
[
:name
]
}
)
conflict!
(
'Label already exists'
)
if
label
label
=
::
Labels
::
CreateService
.
new
(
declared_params
(
include_missing:
false
)).
execute
(
group:
user_group
)
...
...
@@ -57,7 +57,7 @@ module API
delete
':id/labels'
do
authorize!
:admin_label
,
user_group
label
=
user_group
.
labels
.
find_by
(
title:
params
[
:name
]
)
label
=
available_labels_for
(
user_group
,
{
title:
params
[
:name
]
}
)
not_found!
(
'Label'
)
unless
label
destroy_conditionally!
(
label
)
...
...
@@ -77,7 +77,7 @@ module API
put
':id/labels'
do
authorize!
:admin_label
,
user_group
label
=
user_group
.
labels
.
find_by
(
title:
params
[
:name
]
)
label
=
available_labels_for
(
user_group
,
{
title:
params
[
:name
]
}
)
not_found!
(
'Label not found'
)
unless
label
label
=
::
Labels
::
UpdateService
.
new
(
declared_params
(
include_missing:
false
)).
execute
(
label
)
...
...
lib/api/helpers.rb
View file @
ee826ad4
...
...
@@ -84,8 +84,8 @@ module API
page
||
not_found!
(
'Wiki Page'
)
end
def
available_labels_for
(
label_parent
)
search_params
=
{
include_ancestor_groups:
true
}
def
available_labels_for
(
label_parent
,
search_params
=
{}
)
search_params
.
merge
(
include_ancestor_groups:
true
)
if
label_parent
.
is_a?
(
Project
)
search_params
[
:project_id
]
=
label_parent
.
id
...
...
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