Commit 795b4a30 authored by Douwe Maan's avatar Douwe Maan Committed by Winnie Hellmann

Link to specific commit note from MR commit discussion link

parent 6aed2212
...@@ -85,7 +85,7 @@ module NotesHelper ...@@ -85,7 +85,7 @@ module NotesHelper
diffs_project_merge_request_path(discussion.project, discussion.noteable, path_params) diffs_project_merge_request_path(discussion.project, discussion.noteable, path_params)
elsif discussion.for_commit? elsif discussion.for_commit?
anchor = discussion.line_code if discussion.diff_discussion? anchor = discussion.diff_discussion? ? discussion.line_code : "note_#{discussion.first_note.id}"
project_commit_path(discussion.project, discussion.noteable, anchor: anchor) project_commit_path(discussion.project, discussion.noteable, anchor: anchor)
end end
......
...@@ -185,8 +185,8 @@ describe NotesHelper do ...@@ -185,8 +185,8 @@ describe NotesHelper do
context 'for a non-diff discussion' do context 'for a non-diff discussion' do
let(:discussion) { create(:discussion_note_on_commit, project: project).to_discussion } let(:discussion) { create(:discussion_note_on_commit, project: project).to_discussion }
it 'returns the commit path' do it 'returns the commit path with the note anchor' do
expect(helper.discussion_path(discussion)).to eq(project_commit_path(project, commit)) expect(helper.discussion_path(discussion)).to eq(project_commit_path(project, commit, anchor: "note_#{discussion.first_note.id}"))
end end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment