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
033ea9d1
Commit
033ea9d1
authored
Oct 13, 2016
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move label management to services on merge requests API
parent
0dbb47f0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
11 deletions
+4
-11
lib/api/merge_requests.rb
lib/api/merge_requests.rb
+4
-11
No files found.
lib/api/merge_requests.rb
View file @
033ea9d1
...
...
@@ -86,14 +86,11 @@ module API
render_api_error!
({
labels:
errors
},
400
)
end
attrs
[
:labels
]
=
params
[
:labels
]
if
params
[
:labels
]
merge_request
=
::
MergeRequests
::
CreateService
.
new
(
user_project
,
current_user
,
attrs
).
execute
if
merge_request
.
valid?
# Find or create labels and attach to issue
if
params
[
:labels
].
present?
merge_request
.
add_labels_by_names
(
params
[
:labels
].
split
(
","
),
current_user
)
end
present
merge_request
,
with:
Entities
::
MergeRequest
,
current_user:
current_user
else
handle_merge_request_errors!
merge_request
.
errors
...
...
@@ -195,15 +192,11 @@ module API
render_api_error!
({
labels:
errors
},
400
)
end
attrs
[
:labels
]
=
params
[
:labels
]
if
params
[
:labels
]
merge_request
=
::
MergeRequests
::
UpdateService
.
new
(
user_project
,
current_user
,
attrs
).
execute
(
merge_request
)
if
merge_request
.
valid?
# Find or create labels and attach to issue
unless
params
[
:labels
].
nil?
merge_request
.
remove_labels
merge_request
.
add_labels_by_names
(
params
[
:labels
].
split
(
","
),
current_user
)
end
present
merge_request
,
with:
Entities
::
MergeRequest
,
current_user:
current_user
else
handle_merge_request_errors!
merge_request
.
errors
...
...
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