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
4281de36
Commit
4281de36
authored
Oct 25, 2012
by
Valeriy Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
API: review 2
parent
56bf829c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
lib/api/entities.rb
lib/api/entities.rb
+1
-2
lib/api/merge_requests.rb
lib/api/merge_requests.rb
+3
-2
No files found.
lib/api/entities.rb
View file @
4281de36
...
@@ -65,8 +65,7 @@ module Gitlab
...
@@ -65,8 +65,7 @@ module Gitlab
end
end
class
MergeRequest
<
Grape
::
Entity
class
MergeRequest
<
Grape
::
Entity
expose
:id
,
:target_branch
,
:source_branch
,
:project_id
,
expose
:id
,
:target_branch
,
:source_branch
,
:project_id
,
:title
,
:closed
,
:merged
:title
,
:closed
,
:merged
expose
:author
,
:assignee
,
using:
Entities
::
UserBasic
expose
:author
,
:assignee
,
using:
Entities
::
UserBasic
end
end
...
...
lib/api/merge_requests.rb
View file @
4281de36
...
@@ -50,12 +50,12 @@ module Gitlab
...
@@ -50,12 +50,12 @@ module Gitlab
# POST /projects/:id/merge_requests
# POST /projects/:id/merge_requests
#
#
post
":id/merge_requests"
do
post
":id/merge_requests"
do
authorize!
:write_merge_request
,
user_project
attrs
=
attributes_for_keys
[
:source_branch
,
:target_branch
,
:assignee_id
,
:title
]
attrs
=
attributes_for_keys
[
:source_branch
,
:target_branch
,
:assignee_id
,
:title
]
merge_request
=
user_project
.
merge_requests
.
new
(
attrs
)
merge_request
=
user_project
.
merge_requests
.
new
(
attrs
)
merge_request
.
author
=
current_user
merge_request
.
author
=
current_user
authorize!
:write_merge_request
,
user_project
if
merge_request
.
save
if
merge_request
.
save
merge_request
.
reload_code
merge_request
.
reload_code
present
merge_request
,
with:
Entities
::
MergeRequest
present
merge_request
,
with:
Entities
::
MergeRequest
...
@@ -105,6 +105,7 @@ module Gitlab
...
@@ -105,6 +105,7 @@ module Gitlab
merge_request
=
user_project
.
merge_requests
.
find
(
params
[
:merge_request_id
])
merge_request
=
user_project
.
merge_requests
.
find
(
params
[
:merge_request_id
])
note
=
merge_request
.
notes
.
new
(
note:
params
[
:note
],
project_id:
user_project
.
id
)
note
=
merge_request
.
notes
.
new
(
note:
params
[
:note
],
project_id:
user_project
.
id
)
note
.
author
=
current_user
note
.
author
=
current_user
if
note
.
save
if
note
.
save
present
note
,
with:
Entities
::
Note
present
note
,
with:
Entities
::
Note
else
else
...
...
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