Skip to content
Snippets Groups Projects
Commit 2df573da authored by Stan Hu's avatar Stan Hu
Browse files

Fix bug where merge request comments created by API would not trigger notifications

parent c99e9edc
No related branches found
No related tags found
1 merge request!1560Fix bug where merge request comments created by API would not trigger notifications
Loading
@@ -2,6 +2,7 @@ Please view this file on the master branch, on stable branches it's out of date.
Loading
@@ -2,6 +2,7 @@ Please view this file on the master branch, on stable branches it's out of date.
   
v 8.1.0 (unreleased) v 8.1.0 (unreleased)
- Make diff file view easier to use on mobile screens (Stan Hu) - Make diff file view easier to use on mobile screens (Stan Hu)
- 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) - Add support for creating directories from Files page (Stan Hu)
- Allow removing of project without confirmation when JavaScript is disabled (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) - Support filtering by "Any" milestone or issue and fix "No Milestone" and "No Label" filters (Stan Hu)
Loading
Loading
Loading
@@ -249,8 +249,16 @@ module API
Loading
@@ -249,8 +249,16 @@ module API
required_attributes! [:note] required_attributes! [:note]
   
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.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 if note.save
present note, with: Entities::MRNote present note, with: Entities::MRNote
Loading
Loading
Loading
@@ -379,9 +379,14 @@ describe API::API, api: true do
Loading
@@ -379,9 +379,14 @@ describe API::API, api: true do
   
describe "POST /projects/:id/merge_request/:merge_request_id/comments" do describe "POST /projects/:id/merge_request/:merge_request_id/comments" do
it "should return comment" 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" post api("/projects/#{project.id}/merge_request/#{merge_request.id}/comments", user), note: "My comment"
expect(response.status).to eq(201) expect(response.status).to eq(201)
expect(json_response['note']).to eq('My comment') 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 end
   
it "should return 400 if note is missing" do it "should return 400 if note is missing" do
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment