diff options
Diffstat (limited to 'app/views/notify')
18 files changed, 76 insertions, 53 deletions
diff --git a/app/views/notify/_note_email.html.haml b/app/views/notify/_note_email.html.haml index 55984472047..2f0e62981ec 100644 --- a/app/views/notify/_note_email.html.haml +++ b/app/views/notify/_note_email.html.haml @@ -2,16 +2,18 @@ - diff_limit = local_assigns.fetch(:diff_limit, nil) - target_url = local_assigns.fetch(:target_url, @target_url) - note_style = local_assigns.fetch(:note_style, "") +- include_stylesheet_link = local_assigns.fetch(:include_stylesheet_link, true) -- discussion = note.discussion if note.part_of_discussion? +- author = local_assigns.fetch(:author) { note.author } +- discussion = local_assigns.fetch(:discussion) { note.discussion } if note.part_of_discussion? %p{ style: "color: #777777;" } = succeed ':' do - = link_to note.author_name, user_url(note.author) + = link_to author.name, user_url(author) - if discussion.nil? = link_to 'commented', target_url - else - - if note.start_of_discussion? + - if discussion.first_note == note started a new - else commented on a @@ -22,14 +24,15 @@ = link_to 'discussion', target_url - if discussion&.diff_discussion? && discussion.on_text? - = content_for :head do - = stylesheet_link_tag 'mailers/highlighted_diff_email' + - if include_stylesheet_link + = content_for :head do + = stylesheet_link_tag 'mailers/highlighted_diff_email' - %table.code + %table.code.gl-mb-5 = render partial: "projects/diffs/email_line", collection: discussion.truncated_diff_lines(diff_limit: diff_limit), as: :line, locals: { diff_file: discussion.diff_file } .md{ style: note_style } - = markdown(note.note, pipeline: :email, author: note.author, current_user: @recipient, issuable_reference_expansion_enabled: true) + = markdown(note.note, pipeline: :email, author: author, current_user: @recipient, issuable_reference_expansion_enabled: true) diff --git a/app/views/notify/_note_email.text.erb b/app/views/notify/_note_email.text.erb index 8e2f7e6f76e..8853519fb8d 100644 --- a/app/views/notify/_note_email.text.erb +++ b/app/views/notify/_note_email.text.erb @@ -1,13 +1,14 @@ <% note = local_assigns.fetch(:note, @note) -%> <% diff_limit = local_assigns.fetch(:diff_limit, nil) -%> <% target_url = local_assigns.fetch(:target_url, @target_url) -%> -<% discussion = note.discussion if note.part_of_discussion? -%> +<% author = local_assigns.fetch(:author) { note.author } -%> +<% discussion = local_assigns.fetch(:discussion) { note.discussion } if note.part_of_discussion? -%> -<%= sanitize_name(note.author_name) -%> +<%= sanitize_name(author.name) -%> <% if discussion.nil? -%> <%= 'commented' -%>: <% else -%> -<% if note.start_of_discussion? -%> +<% if discussion.first_note == note -%> <%= 'started a new discussion' -%> <% else -%> <%= 'commented on a discussion' -%> diff --git a/app/views/notify/issue_due_email.html.haml b/app/views/notify/issue_due_email.html.haml index e512d7732e2..3208d061928 100644 --- a/app/views/notify/issue_due_email.html.haml +++ b/app/views/notify/issue_due_email.html.haml @@ -1,11 +1,11 @@ %p.details - #{link_to @issue.author_name, user_url(@issue.author)}'s issue #{issue_reference_link(@issue)} is due soon. + = sprintf(s_("Notify|%{author_link}'s issue %{issue_reference_link} is due soon."), { author_link: link_to(@issue.author_name, user_url(@issue.author)), issue_reference_link: issue_reference_link(@issue) }) - if @issue.assignees.any? %p = assignees_label(@issue) %p - This issue is due on: #{@issue.due_date.to_s(:medium)} + = sprintf(s_('Notify|This issue is due on: %{issue_due_date}'), { issue_due_date: @issue.due_date.to_s(:medium) }).html_safe - if @issue.description .md diff --git a/app/views/notify/issue_moved_email.html.haml b/app/views/notify/issue_moved_email.html.haml index b766cb1a523..c77a863d1a4 100644 --- a/app/views/notify/issue_moved_email.html.haml +++ b/app/views/notify/issue_moved_email.html.haml @@ -1,9 +1,7 @@ %p - Issue was moved to another project. + = s_('Notify|Issue was moved to another project.') - if @can_access_project %p - New issue: - = link_to project_issue_url(@new_project, @new_issue) do - = @new_issue.title + = sprintf(s_('Notify|New issue: %{project_issue_url}'), { project_issue_url: link_to(@new_issue.title, project_issue_url(@new_project, @new_issue)) } ).html_safe - else - You don't have access to the project. + = s_("Notify|You don't have access to the project.") diff --git a/app/views/notify/issue_status_changed_email.html.haml b/app/views/notify/issue_status_changed_email.html.haml index 66e73a9b03f..545f9c006af 100644 --- a/app/views/notify/issue_status_changed_email.html.haml +++ b/app/views/notify/issue_status_changed_email.html.haml @@ -1,2 +1,2 @@ %p - Issue was #{@issue_status} by #{sanitize_name(@updated_by.name)} + = sprintf(s_('Notify|Issue was %{issue_status} by %{updated_by}'), { issue_status: @issue_status, updated_by: sanitize_name(@updated_by.name) }).html_safe diff --git a/app/views/notify/merge_request_status_email.html.haml b/app/views/notify/merge_request_status_email.html.haml index 49f2366c594..8e8d27b3cec 100644 --- a/app/views/notify/merge_request_status_email.html.haml +++ b/app/views/notify/merge_request_status_email.html.haml @@ -1,3 +1,3 @@ %p - Merge request #{merge_request_reference_link(@merge_request)} - was #{@mr_status} by #{sanitize_name(@updated_by.name)} + = sprintf(s_('Notify|Merge request %{merge_request} was %{mr_status} by %{updated_by}'), + { merge_request: merge_request_reference_link(@merge_request), mr_status: @mr_status, updated_by: sanitize_name(@updated_by.name) }).html_safe diff --git a/app/views/notify/merge_request_status_email.text.haml b/app/views/notify/merge_request_status_email.text.haml index 1a8f848218c..f3845b2b910 100644 --- a/app/views/notify/merge_request_status_email.text.haml +++ b/app/views/notify/merge_request_status_email.text.haml @@ -1,9 +1,9 @@ -Merge request #{@merge_request.to_reference} was #{@mr_status} by #{sanitize_name(@updated_by.name)} += sprintf(s_('Notify|Merge request %{merge_request} was %{mr_status}'), { merge_request: @merge_request.to_reference, mr_status: sanitize_name(@updated_by.name) }) -Merge request URL: #{project_merge_request_url(@merge_request.target_project, @merge_request)} += sprintf(s_('Notify|Merge request URL: %{merge_request_url}'), { merge_request_url: project_merge_request_url(@merge_request.target_project, @merge_request) }) = merge_path_description(@merge_request, 'to') -Author: #{sanitize_name(@merge_request.author_name)} += sprintf(s_('Notify|Author: %{author_name}'), { author_name: sanitize_name(@merge_request.author_name) }) = assignees_label(@merge_request) = reviewers_label(@merge_request) diff --git a/app/views/notify/merge_request_unmergeable_email.html.haml b/app/views/notify/merge_request_unmergeable_email.html.haml index fddf9eaf95a..6bcff28985c 100644 --- a/app/views/notify/merge_request_unmergeable_email.html.haml +++ b/app/views/notify/merge_request_unmergeable_email.html.haml @@ -1,2 +1,2 @@ %p - Merge request #{merge_request_reference_link(@merge_request)} can no longer be merged due to conflict. + = sprintf(s_('Notify|Merge request %{merge_request} can no longer be merged due to conflict.'), { merge_request: merge_request_reference_link(@merge_request) }).html_safe diff --git a/app/views/notify/merge_request_unmergeable_email.text.haml b/app/views/notify/merge_request_unmergeable_email.text.haml index 3db5f21e6c2..22d56e73ca8 100644 --- a/app/views/notify/merge_request_unmergeable_email.text.haml +++ b/app/views/notify/merge_request_unmergeable_email.text.haml @@ -1,9 +1,9 @@ -Merge request #{@merge_request.to_reference} can no longer be merged due to conflict. += sprintf(s_('Notify|Merge request %{merge_request} can no longer be merged due to conflict.'), { merge_request: @merge_request.to_reference }) -Merge request URL: #{project_merge_request_url(@merge_request.target_project, @merge_request)} += sprintf(s_('Notify|Merge request URL: %{merge_request_url}'), { merge_request_url: project_merge_request_url(@merge_request.target_project, @merge_request) }) = merge_path_description(@merge_request, 'to') -Author: #{sanitize_name(@merge_request.author_name)} += sprintf(s_('Author: %{author_name}'), { author_name: sanitize_name(@merge_request.author_name) }) = assignees_label(@merge_request) = reviewers_label(@merge_request) diff --git a/app/views/notify/merged_merge_request_email.html.haml b/app/views/notify/merged_merge_request_email.html.haml index f0dadd9ce91..0622e2f6ffb 100644 --- a/app/views/notify/merged_merge_request_email.html.haml +++ b/app/views/notify/merged_merge_request_email.html.haml @@ -1,2 +1,2 @@ %p - Merge request #{merge_request_reference_link(@merge_request)} was merged + = sprintf(s_('Notify|Merge request %{merge_request} was merged'), { merge_request: merge_request_reference_link(@merge_request) }).html_safe diff --git a/app/views/notify/merged_merge_request_email.text.haml b/app/views/notify/merged_merge_request_email.text.haml index 91f920dec21..d6ec916641d 100644 --- a/app/views/notify/merged_merge_request_email.text.haml +++ b/app/views/notify/merged_merge_request_email.text.haml @@ -1,9 +1,9 @@ -Merge request #{@merge_request.to_reference} was merged += sprintf(s_('Notify|Merge request %{merge_request} was merged'), { merge_request: @merge_request.to_reference }) -Merge request URL: #{project_merge_request_url(@merge_request.target_project, @merge_request)} += sprintf(s_('Notify|Merge request URL: %{merge_request_url}'), { merge_request_url: project_merge_request_url(@merge_request.target_project, @merge_request) }) = merge_path_description(@merge_request, 'to') -Author: #{sanitize_name(@merge_request.author_name)} += sprintf(s_('Notify|Author: %{author_name}'), { author_name: sanitize_name(@merge_request.author_name) }) = assignees_label(@merge_request) = reviewers_label(@merge_request) diff --git a/app/views/notify/new_email_address_added_email.erb b/app/views/notify/new_email_address_added_email.erb new file mode 100644 index 00000000000..3af1953c902 --- /dev/null +++ b/app/views/notify/new_email_address_added_email.erb @@ -0,0 +1,5 @@ +<%= say_hi(@user) %> + +<%= new_email_address_added_text(@email) %> + +<%= remove_email_address_text %> diff --git a/app/views/notify/new_email_address_added_email.haml b/app/views/notify/new_email_address_added_email.haml new file mode 100644 index 00000000000..6d00aaedfd5 --- /dev/null +++ b/app/views/notify/new_email_address_added_email.haml @@ -0,0 +1,6 @@ +%p + = say_hi(@user) +%p + = new_email_address_added_text(@email) +%p + = remove_email_address_text(format: :html) diff --git a/app/views/notify/new_merge_request_email.html.haml b/app/views/notify/new_merge_request_email.html.haml index f67ac5f8fb2..1542d5bba85 100644 --- a/app/views/notify/new_merge_request_email.html.haml +++ b/app/views/notify/new_merge_request_email.html.haml @@ -2,18 +2,17 @@ = html_escape(_('%{user} created a merge request: %{mr_link}')) % { user: link_to(@merge_request.author_name, user_url(@merge_request.author)), mr_link: merge_request_reference_link(@merge_request) } -%p - .branch - = merge_path_description(@merge_request, 'to') - .author - Author: #{@merge_request.author_name} - .assignee - = assignees_label(@merge_request) - .reviewer - = reviewers_label(@merge_request) - .approvers - = render_if_exists 'notify/merge_request_approvers', presenter: @mr_presenter +.branch + = merge_path_description(@merge_request, 'to') +.author + Author: #{@merge_request.author_name} +.assignee + = assignees_label(@merge_request) +.reviewer + = reviewers_label(@merge_request) +.approvers + = render_if_exists 'notify/merge_request_approvers', presenter: @mr_presenter - if @merge_request.description - .md + .md.gl-mt-5 = markdown(@merge_request.description, pipeline: :email, author: @merge_request.author, current_user: @recipient, issuable_reference_expansion_enabled: true) diff --git a/app/views/notify/new_review_email.html.haml b/app/views/notify/new_review_email.html.haml index 11da7723d8d..afc1bd68215 100644 --- a/app/views/notify/new_review_email.html.haml +++ b/app/views/notify/new_review_email.html.haml @@ -1,3 +1,7 @@ +- if @include_diff_discussion_stylesheet + = content_for :head do + = stylesheet_link_tag 'mailers/highlighted_diff_email' + %table{ border: "0", cellpadding: "0", cellspacing: "0", style: "width:100%;margin:0 auto;border-collapse:separate;border-spacing:0;" } %tbody %tr @@ -5,12 +9,16 @@ %table{ border: "0", cellpadding: "0", cellspacing: "0", style: "width:100%;border-collapse:separate;border-spacing:0;" } %tbody %tr - %td{ style: "color:#333333;border-bottom:1px solid #ededed;font-size:15px;font-weight:bold;line-height:1.4;padding: 20px 0;" } + %td{ style: "color:#333333;border-bottom:1px solid #ededed;font-weight:bold;line-height:1.4;padding: 20px 0;" } - mr_link = link_to(@merge_request.to_reference(@project), project_merge_request_url(@project, @merge_request)) - mr_author_link = link_to(@author_name, user_url(@author)) = _('Merge request %{mr_link} was reviewed by %{mr_author}').html_safe % { mr_link: mr_link, mr_author: mr_author_link } %tr - %td{ style: "overflow:hidden;font-size:14px;line-height:1.4;display:grid;" } + %td{ style: "overflow:hidden;line-height:1.4;display:grid;" } - @notes.each do |note| + -# Get preloaded note discussion + - discussion = @discussions[note.discussion_id] if note.part_of_discussion? + -# Preload project for discussions first note + - discussion.first_note.project = @project if discussion&.first_note - target_url = project_merge_request_url(@project, @merge_request, anchor: "note_#{note.id}") - = render 'note_email', note: note, diff_limit: 3, target_url: target_url, note_style: "border-bottom:1px solid #ededed;" + = render 'note_email', note: note, diff_limit: 3, target_url: target_url, note_style: "border-bottom:1px solid #ededed; padding-bottom: 1em;", include_stylesheet_link: false, discussion: discussion, author: @author diff --git a/app/views/notify/new_review_email.text.erb b/app/views/notify/new_review_email.text.erb index 164735abad0..7bf878aefd0 100644 --- a/app/views/notify/new_review_email.text.erb +++ b/app/views/notify/new_review_email.text.erb @@ -4,8 +4,10 @@ -- <% @notes.each_with_index do |note, index| %> + <!-- Get preloaded note discussion--> + <% discussion = @discussions[note.discussion_id] if note.part_of_discussion?%> <% target_url = project_merge_request_url(@project, @merge_request, anchor: "note_#{note.id}") %> - <%= render 'note_email', note: note, diff_limit: 3, target_url: target_url %> + <%= render 'note_email', note: note, diff_limit: 3, target_url: target_url, discussion: discussion, author: @author %> <% if index != @notes.length-1 %> -- diff --git a/app/views/notify/push_to_merge_request_email.html.haml b/app/views/notify/push_to_merge_request_email.html.haml index 3e9f9b442e0..5197a1bdd08 100644 --- a/app/views/notify/push_to_merge_request_email.html.haml +++ b/app/views/notify/push_to_merge_request_email.html.haml @@ -3,24 +3,25 @@ pushed new commits to merge request = merge_request_reference_link(@merge_request) -- if @existing_commits.any? - - count = @existing_commits.size +- if @total_existing_commits_count > 0 %ul %li - - if count == 1 + - if @total_existing_commits_count == 1 - commit_id = @existing_commits.first[:short_id] = link_to(commit_id, project_commit_url(@merge_request.target_project, commit_id)) - else = link_to(project_compare_url(@merge_request.target_project, from: @existing_commits.first[:short_id], to: @existing_commits.last[:short_id])) do #{@existing_commits.first[:short_id]}...#{@existing_commits.last[:short_id]} = precede ' - ' do - - commits_text = "#{count} commit".pluralize(count) + - commits_text = "#{@total_existing_commits_count} commit".pluralize(@total_existing_commits_count) #{commits_text} from branch `#{@merge_request.target_branch}` -- if @new_commits.any? +- if @total_new_commits_count > 0 %ul - @new_commits.each do |commit| %li = link_to(commit[:short_id], project_commit_url(@merge_request.target_project, commit[:short_id])) = precede ' - ' do #{commit[:title]} + - if @total_stripped_new_commits_count > 0 + %li And #{@total_stripped_new_commits_count} more diff --git a/app/views/notify/service_desk_new_note_email.html.haml b/app/views/notify/service_desk_new_note_email.html.haml index 0c16cf3315f..02f6b3914c9 100644 --- a/app/views/notify/service_desk_new_note_email.html.haml +++ b/app/views/notify/service_desk_new_note_email.html.haml @@ -1,5 +1,5 @@ - if Gitlab::CurrentSettings.email_author_in_body - %div + .gl-mb-5 = _("%{author_link} wrote:").html_safe % { author_link: link_to(@note.author_name, user_url(@note.author)) } .md = markdown(@note.note, pipeline: :email, author: @note.author, issuable_reference_expansion_enabled: true) |