Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouwe Maan <douwe@selenight.nl>2017-04-01 03:10:53 +0300
committerDouwe Maan <douwe@selenight.nl>2017-04-08 22:37:46 +0300
commitd65d245e06fbe45455e130e2d4ca0ca1d066a8c6 (patch)
tree37582457af03e9fbc5ac0ea9df2819640e1de365 /app/helpers/notes_helper.rb
parent2c0de7aaafd5fb842618bb7fa218e11255363bc8 (diff)
Add link to diff header too
Diffstat (limited to 'app/helpers/notes_helper.rb')
-rw-r--r--app/helpers/notes_helper.rb13
1 files changed, 10 insertions, 3 deletions
diff --git a/app/helpers/notes_helper.rb b/app/helpers/notes_helper.rb
index 5f3d89cf6cb..b244ae4fcbf 100644
--- a/app/helpers/notes_helper.rb
+++ b/app/helpers/notes_helper.rb
@@ -61,10 +61,17 @@ module NotesHelper
end
def discussion_diff_path(discussion)
- return unless discussion.diff_discussion?
+ if discussion.for_merge_request?
+ if discussion.active?
+ # Without a diff ID, the link always points to the latest diff version
+ diff_id = nil
+ elsif merge_request_diff = discussion.latest_merge_request_diff
+ diff_id = merge_request_diff.id
+ else
+ return
+ end
- if discussion.for_merge_request? && discussion.active?
- diffs_namespace_project_merge_request_path(discussion.project.namespace, discussion.project, discussion.noteable, anchor: discussion.line_code)
+ diffs_namespace_project_merge_request_path(discussion.project.namespace, discussion.project, discussion.noteable, diff_id: diff_id, anchor: discussion.line_code)
elsif discussion.for_commit?
namespace_project_commit_path(discussion.project.namespace, discussion.project, discussion.noteable, anchor: discussion.line_code)
end