Skip to content
Snippets Groups Projects
Commit 854fbbfb authored by Sean McGivern's avatar Sean McGivern
Browse files

Tidy up text emails

parent 938de311
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -165,18 +165,21 @@ class Discussion
 
# Returns an array of at most 16 highlighted lines above a diff note
def truncated_diff_lines(highlight: true)
initial_lines = highlight ? highlighted_diff_lines : diff_lines
lines = highlight ? highlighted_diff_lines : diff_lines
prev_lines = []
 
initial_lines.each do |line|
lines.each do |line|
if line.meta?
prev_lines.clear
else
prev_lines << line
break if for_line?(line)
prev_lines.shift if prev_lines.length >= NUMBER_OF_TRUNCATED_DIFF_LINES
end
end
prev_lines
end
 
Loading
Loading
<% if @note.diff_note? && @note.diff_file -%>
<% if @discussion && @discussion.diff_file -%>
on <%= @note.diff_file.file_path -%>
<% end -%>:
 
Loading
Loading
<% @discussion.truncated_diff_lines(highlight: false).each do |line| %>
<%= "> " + line.text %>
> <%= line.text %>
<% end %>
<% url = url_for(namespace_project_commit_url(@note.project.namespace, @note.project, id: @commit.id, anchor: "note_#{@note.id}")) %>
New comment for Commit <%= @commit.short_id -%>
<%= render partial: 'note_mr_or_commit_email', locals: { url: url } %>
<%= render partial: 'note_mr_or_commit_email', locals: { url: @target_url } %>
<% url = url_for(namespace_project_merge_request_url(@merge_request.target_project.namespace, @merge_request.target_project, @merge_request, anchor: "note_#{@note.id}")) %>
New comment for Merge Request <%= @merge_request.to_reference -%>
<%= render partial: 'note_mr_or_commit_email', locals: { url: url }%>
<%= render partial: 'note_mr_or_commit_email', locals: { url: @target_url }%>
Loading
Loading
@@ -50,7 +50,7 @@ describe Notify do
 
context 'when enabled email_author_in_body' do
before do
allow_any_instance_of(ApplicationSetting).to receive(:email_author_in_body).and_return(true)
stub_application_setting(email_author_in_body: true)
end
 
it 'contains a link to note author' do
Loading
Loading
@@ -229,7 +229,7 @@ describe Notify do
 
context 'when enabled email_author_in_body' do
before do
allow_any_instance_of(ApplicationSetting).to receive(:email_author_in_body).and_return(true)
stub_application_setting(email_author_in_body: true)
end
 
it 'contains a link to note author' do
Loading
Loading
@@ -607,7 +607,7 @@ describe Notify do
 
context 'when enabled email_author_in_body' do
before do
allow_any_instance_of(ApplicationSetting).to receive(:email_author_in_body).and_return(true)
stub_application_setting(email_author_in_body: true)
end
 
it 'contains a link to note author' do
Loading
Loading
@@ -726,7 +726,7 @@ describe Notify do
 
context 'when enabled email_author_in_body' do
before do
allow_any_instance_of(ApplicationSetting).to receive(:email_author_in_body).and_return(true)
stub_application_setting(email_author_in_body: true)
end
 
it 'contains a link to note author' do
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment