summaryrefslogtreecommitdiff
path: root/app/views/notify
diff options
context:
space:
mode:
authorYar <YarTheGreat@gmail.com>2016-11-13 21:18:03 +0300
committerYarNayar <YarTheGreat@gmail.com>2016-11-15 20:51:21 +0300
commit8782bb96cca3ade2b367f588fd8332906dcc2d1b (patch)
tree9f46f21807532db46d72cd5f4936d088368f5fd7 /app/views/notify
parent5b876592b47209e431d37b281aacb187df870ea3 (diff)
downloadgitlab-ce-8782bb96cca3ade2b367f588fd8332906dcc2d1b.tar.gz
Unify anchor link format for MR diff files !7298
Right now, the following naming scheme for diff files is used: diff-1, diff-2, ... and also we have "internal" format which is file-path-HASH, where HASH is sha1 of file path. Besides, we have HASH_lineA_lineB format to link exact line number in MR diff. It makes sence to unify the way we link diff from outside, while leave "file-path-HASH" format for internal (js) usage. Changes in this commit allow to link diff just by HASH, if we don't want specify exact lines, also it changes "file-path-HASH" and "diff-NUMBER" links in code to this unified format. Inspired by #24010 and !7298
Diffstat (limited to 'app/views/notify')
-rw-r--r--app/views/notify/repository_push_email.html.haml11
1 files changed, 6 insertions, 5 deletions
diff --git a/app/views/notify/repository_push_email.html.haml b/app/views/notify/repository_push_email.html.haml
index c0c07d65daa..307c5a11206 100644
--- a/app/views/notify/repository_push_email.html.haml
+++ b/app/views/notify/repository_push_email.html.haml
@@ -27,9 +27,9 @@
%h4 #{pluralize @message.diffs_count, "changed file"}:
%ul
- - @message.diffs.each_with_index do |diff, i|
+ - @message.diffs.each do |diff|
%li.file-stats
- %a{href: "#{@message.target_url if @message.disable_diffs?}#diff-#{i}" }
+ %a{href: "#{@message.target_url if @message.disable_diffs?}##{hexdigest(diff.file_path)}" }
- if diff.deleted_file
%span.deleted-file
&minus;
@@ -52,9 +52,10 @@
%h5 The diff was not included because it is too large.
- else
%h4 Changes:
- - diff_files.each_with_index do |diff_file, i|
- %li{id: "diff-#{i}"}
- %a{href: @message.target_url + "#diff-#{i}"}<
+ - diff_files.each do |diff_file|
+ - file_hash = hexdigest(diff_file.file_path)
+ %li{id: file_hash}
+ %a{href: @message.target_url + "##{file_hash}"}<
- if diff_file.deleted_file
%strong<
= diff_file.old_path