BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
d536d959
Commit
d536d959
authored
Mar 27, 2017
by
Toon Claes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove `:id/merge_requests/:merge_request_iid/comments` endpoints
Comments for a merge request should be obtained to the `notes` endpoint.
parent
b941b0eb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
93 deletions
+0
-93
merge_requests.rb
lib/api/merge_requests.rb
+0
-35
merge_requests_spec.rb
spec/requests/api/merge_requests_spec.rb
+0
-58
No files found.
lib/api/merge_requests.rb
View file @
d536d959
...
...
@@ -226,41 +226,6 @@ module API
.
cancel
(
merge_request
)
end
desc
'Get the comments of a merge request'
do
success
Entities
::
MRNote
end
params
do
use
:pagination
end
get
':id/merge_requests/:merge_request_iid/comments'
do
merge_request
=
find_merge_request_with_access
(
params
[
:merge_request_iid
])
present
paginate
(
merge_request
.
notes
.
fresh
),
with:
Entities
::
MRNote
end
desc
'Post a comment to a merge request'
do
success
Entities
::
MRNote
end
params
do
requires
:note
,
type:
String
,
desc:
'The text of the comment'
end
post
':id/merge_requests/:merge_request_iid/comments'
do
merge_request
=
find_merge_request_with_access
(
params
[
:merge_request_iid
],
:create_note
)
opts
=
{
note:
params
[
:note
],
noteable_type:
'MergeRequest'
,
noteable_id:
merge_request
.
id
}
note
=
::
Notes
::
CreateService
.
new
(
user_project
,
current_user
,
opts
).
execute
if
note
.
save
present
note
,
with:
Entities
::
MRNote
else
render_api_error!
(
"Failed to save note
#{
note
.
errors
.
messages
}
"
,
400
)
end
end
desc
'List issues that will be closed on merge'
do
success
Entities
::
MRNote
end
...
...
spec/requests/api/merge_requests_spec.rb
View file @
d536d959
...
...
@@ -623,64 +623,6 @@ describe API::MergeRequests, api: true do
end
end
describe
"POST /projects/:id/merge_requests/:merge_request_iid/comments"
do
it
"returns comment"
do
original_count
=
merge_request
.
notes
.
size
post
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
iid
}
/comments"
,
user
),
note:
"My comment"
expect
(
response
).
to
have_http_status
(
201
)
expect
(
json_response
[
'note'
]).
to
eq
(
'My comment'
)
expect
(
json_response
[
'author'
][
'name'
]).
to
eq
(
user
.
name
)
expect
(
json_response
[
'author'
][
'username'
]).
to
eq
(
user
.
username
)
expect
(
merge_request
.
reload
.
notes
.
size
).
to
eq
(
original_count
+
1
)
end
it
"returns 400 if note is missing"
do
post
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
iid
}
/comments"
,
user
)
expect
(
response
).
to
have_http_status
(
400
)
end
it
"returns 404 if merge request iid is invalid"
do
post
api
(
"/projects/
#{
project
.
id
}
/merge_requests/404/comments"
,
user
),
note:
'My comment'
expect
(
response
).
to
have_http_status
(
404
)
end
it
"returns 404 if merge request id is used instead of iid"
do
post
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
id
}
/comments"
,
user
),
note:
'My comment'
expect
(
response
).
to
have_http_status
(
404
)
end
end
describe
"GET :id/merge_requests/:merge_request_iid/comments"
do
let!
(
:note
)
{
create
(
:note_on_merge_request
,
author:
user
,
project:
project
,
noteable:
merge_request
,
note:
"a comment on a MR"
)
}
let!
(
:note2
)
{
create
(
:note_on_merge_request
,
author:
user
,
project:
project
,
noteable:
merge_request
,
note:
"another comment on a MR"
)
}
it
"returns merge_request comments ordered by created_at"
do
get
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
iid
}
/comments"
,
user
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
2
)
expect
(
json_response
.
first
[
'note'
]).
to
eq
(
"a comment on a MR"
)
expect
(
json_response
.
first
[
'author'
][
'id'
]).
to
eq
(
user
.
id
)
expect
(
json_response
.
last
[
'note'
]).
to
eq
(
"another comment on a MR"
)
end
it
"returns a 404 error if merge_request_iid is invalid"
do
get
api
(
"/projects/
#{
project
.
id
}
/merge_requests/999/comments"
,
user
)
expect
(
response
).
to
have_http_status
(
404
)
end
it
"returns a 404 error if merge_request id is used instead of iid"
do
get
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
id
}
/comments"
,
user
)
expect
(
response
).
to
have_http_status
(
404
)
end
end
describe
'GET :id/merge_requests/:merge_request_iid/closes_issues'
do
it
'returns the issue that will be closed on merge'
do
issue
=
create
(
:issue
,
project:
project
)
...
...
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