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
Jérome Perrin
gitlab-ce
Commits
353ddbc7
Commit
353ddbc7
authored
Oct 15, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'stanhu/gitlab-ce-fix-api-mr-comment-notifications'
parents
0d09b5fe
2df573da
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
2 deletions
+16
-2
CHANGELOG
CHANGELOG
+1
-0
lib/api/merge_requests.rb
lib/api/merge_requests.rb
+10
-2
spec/requests/api/merge_requests_spec.rb
spec/requests/api/merge_requests_spec.rb
+5
-0
No files found.
CHANGELOG
View file @
353ddbc7
...
...
@@ -5,6 +5,7 @@ v 8.1.0 (unreleased)
- Speed up load times of issue detail pages by roughly 1.5x
- Make diff file view easier to use on mobile screens (Stan Hu)
- Improved performance of finding users by username or Email address
- Fix bug where merge request comments created by API would not trigger notifications (Stan Hu)
- Add support for creating directories from Files page (Stan Hu)
- Allow removing of project without confirmation when JavaScript is disabled (Stan Hu)
- Support filtering by "Any" milestone or issue and fix "No Milestone" and "No Label" filters (Stan Hu)
...
...
lib/api/merge_requests.rb
View file @
353ddbc7
...
...
@@ -249,8 +249,16 @@ module API
required_attributes!
[
:note
]
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
.
author
=
current_user
authorize!
:create_note
,
merge_request
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
...
...
spec/requests/api/merge_requests_spec.rb
View file @
353ddbc7
...
...
@@ -379,9 +379,14 @@ describe API::API, api: true do
describe
"POST /projects/:id/merge_request/:merge_request_id/comments"
do
it
"should return comment"
do
original_count
=
merge_request
.
notes
.
size
post
api
(
"/projects/
#{
project
.
id
}
/merge_request/
#{
merge_request
.
id
}
/comments"
,
user
),
note:
"My comment"
expect
(
response
.
status
).
to
eq
(
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
.
notes
.
size
).
to
eq
(
original_count
+
1
)
end
it
"should return 400 if note is missing"
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