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
Léo-Paul Géneau
gitlab-ce
Commits
6c9f527b
Commit
6c9f527b
authored
Jul 16, 2015
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Return comments in created order in merge request API
Closes #1832
parent
daed441d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
3 deletions
+6
-3
CHANGELOG
CHANGELOG
+1
-0
lib/api/merge_requests.rb
lib/api/merge_requests.rb
+1
-1
spec/requests/api/merge_requests_spec.rb
spec/requests/api/merge_requests_spec.rb
+4
-2
No files found.
CHANGELOG
View file @
6c9f527b
Please view this file on the master branch, on stable branches it's out of date.
v 7.13.0 (unreleased)
- Return comments in created order in merge request API (Stan Hu)
- Only enable HSTS header for HTTPS and port 443 (Stan Hu)
- Fix user autocomplete for unauthenticated users accessing public projects (Stan Hu)
- Fix redirection to home page URL for unauthorized users (Daniel Gerhardt)
...
...
lib/api/merge_requests.rb
View file @
6c9f527b
...
...
@@ -229,7 +229,7 @@ module API
authorize!
:read_merge_request
,
merge_request
present
paginate
(
merge_request
.
notes
),
with:
Entities
::
MRNote
present
paginate
(
merge_request
.
notes
.
fresh
),
with:
Entities
::
MRNote
end
# Post comment to merge request
...
...
spec/requests/api/merge_requests_spec.rb
View file @
6c9f527b
...
...
@@ -8,6 +8,7 @@ describe API::API, api: true do
let!
(
:merge_request_closed
)
{
create
(
:merge_request
,
state:
"closed"
,
author:
user
,
assignee:
user
,
source_project:
project
,
target_project:
project
,
title:
"Closed test"
)
}
let!
(
:merge_request_merged
)
{
create
(
:merge_request
,
state:
"merged"
,
author:
user
,
assignee:
user
,
source_project:
project
,
target_project:
project
,
title:
"Merged test"
)
}
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"
)
}
before
do
project
.
team
<<
[
user
,
:reporters
]
...
...
@@ -397,13 +398,14 @@ describe API::API, api: true do
end
describe
"GET :id/merge_request/:merge_request_id/comments"
do
it
"should return merge_request comments"
do
it
"should return merge_request comments
ordered by created_at
"
do
get
api
(
"/projects/
#{
project
.
id
}
/merge_request/
#{
merge_request
.
id
}
/comments"
,
user
)
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
1
)
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
"should return a 404 error if merge_request_id not found"
do
...
...
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