Commit 69594f08 authored by Enrique Alcántara's avatar Enrique Alcántara

Merge branch...

Merge branch '328338-inconsistent-initial-line-in-merge-request-and-issue-creation-emails' into 'master'

Make new issue, merge request and epic email have the same format

See merge request gitlab-org/gitlab!59718
parents 53e53b2a 914c0fa5
...@@ -88,6 +88,10 @@ class NotifyPreview < ActionMailer::Preview ...@@ -88,6 +88,10 @@ class NotifyPreview < ActionMailer::Preview
Notify.issues_csv_email(user, project, '1997,Ford,E350', { truncated: false, rows_expected: 3, rows_written: 3 }).message Notify.issues_csv_email(user, project, '1997,Ford,E350', { truncated: false, rows_expected: 3, rows_written: 3 }).message
end end
def new_issue_email
Notify.new_issue_email(user.id, issue.id).message
end
def new_merge_request_email def new_merge_request_email
Notify.new_merge_request_email(user.id, merge_request.id).message Notify.new_merge_request_email(user.id, merge_request.id).message
end end
...@@ -200,7 +204,7 @@ class NotifyPreview < ActionMailer::Preview ...@@ -200,7 +204,7 @@ class NotifyPreview < ActionMailer::Preview
end end
def issue def issue
@merge_request ||= project.issues.first @issue ||= project.issues.first
end end
def merge_request def merge_request
......
%p.details %p.details
#{link_to @issue.author_name, user_url(@issue.author)} created an issue #{issue_reference_link(@issue)}: = html_escape(_('%{user} created an issue: %{issue_link}')) % { user: link_to(@issue.author_name, user_url(@issue.author)),
issue_link: issue_reference_link(@issue) }
- if @issue.assignees.any? - if @issue.assignees.any?
%p %p
......
<%= sanitize_name(@issue.author_name) %> <%= 'created an issue:' %> <%= url_for(project_issue_url(@issue.project, @issue)) %> <%= _('%{user} created an issue: %{issue_link}') % { user: sanitize_name(@issue.author_name),
issue_link: url_for(project_issue_url(@issue.project, @issue)) } %>
<%= assignees_label(@issue) if @issue.assignees.any? %> <%= assignees_label(@issue) if @issue.assignees.any? %>
......
%p.details %p.details
= html_escape(_('%{userLinkStart}%{user}%{linkEnd} created a %{mrLinkStart}merge request%{linkEnd}:')) % {userLinkStart: "<a href=\"#{user_url(@merge_request.author)}\">".html_safe, = html_escape(_('%{user} created a merge request: %{mr_link}')) % { user: link_to(@merge_request.author_name, user_url(@merge_request.author)),
user: @merge_request.author_name, mr_link: merge_request_reference_link(@merge_request) }
mrLinkStart: "<a href=\"#{@target_url}\">".html_safe,
linkEnd: '</a>'.html_safe}
%p %p
.branch .branch
......
<%= sanitize_name(@merge_request.author_name) %> <%= 'created a merge request:' %> <%= url_for(project_merge_request_url(@merge_request.target_project, @merge_request)) %> <%= _('%{user} created a merge request: %{mr_link}') % { user: sanitize_name(@merge_request.author_name),
mr_link: url_for(project_merge_request_url(@merge_request.target_project, @merge_request)) }
%>
<%= merge_path_description(@merge_request, 'to') %> <%= merge_path_description(@merge_request, 'to') %>
<%= 'Author:' %> <%= @merge_request.author_name %> <%= "#{_('Author')}: #{sanitize_name(@merge_request.author_name)}" %>
<%= assignees_label(@merge_request) if @merge_request.assignees.any? %> <%= assignees_label(@merge_request) if @merge_request.assignees.any? %>
<%= reviewers_label(@merge_request) if @merge_request.reviewers.any? %> <%= reviewers_label(@merge_request) if @merge_request.reviewers.any? %>
<%= render_if_exists 'notify/merge_request_approvers', presenter: @mr_presenter %> <%= render_if_exists 'notify/merge_request_approvers', presenter: @mr_presenter %>
......
---
title: Make new issue, merge request, and epic emails more consistent
merge_request: 59718
author:
type: changed
...@@ -54,6 +54,10 @@ module EE ...@@ -54,6 +54,10 @@ module EE
def new_group_member_with_confirmation_email def new_group_member_with_confirmation_email
::Notify.provisioned_member_access_granted_email(member.id).message ::Notify.provisioned_member_access_granted_email(member.id).message
end end
def new_epic_email
::Notify.new_epic_email(user.id, epic.id).message
end
end end
private private
...@@ -61,6 +65,10 @@ module EE ...@@ -61,6 +65,10 @@ module EE
def approver def approver
@user ||= ::User.first @user ||= ::User.first
end end
def epic
@epic ||= project.group.epics.first
end
end end
end end
end end
%p.details %p.details
#{link_to @epic.author_name, user_url(@epic.author)} created an epic: = html_escape(_('%{user} created an epic: %{epic_link}')) % { user: link_to(@epic.author_name, user_url(@epic.author)),
epic_link: link_to(@epic.to_reference, group_epic_url(@epic.group, @epic)) }
- if @epic.assignee - if @epic.assignee
%p %p
......
<%= sanitize_name(@epic.author_name) %> created an epic: <%= _('%{user} created an epic: %{epic_link}') % { user: sanitize_name(@epic.author_name),
epic_link: url_for(group_epic_url(@epic.group, @epic)) }
%>
<% if @epic.assignee %> <%= assignees_label(@epic) if @epic.assignee %>
<%= assignees_label(@issue) %>
<% end %>
<% if @epic.description -%> <%= @epic.description if @epic.description %>
<%= @epic.description %>
<% end %>
...@@ -246,6 +246,16 @@ RSpec.describe Notify do ...@@ -246,6 +246,16 @@ RSpec.describe Notify do
end end
end end
it 'contains a link to epic author' do
is_expected.to have_body_text(epic.author_name)
is_expected.to have_body_text 'created an epic:'
is_expected.to have_link(epic.to_reference, href: group_epic_url(group, epic))
end
it 'contains a link to the epic' do
is_expected.to have_body_text(epic.to_reference)
end
context 'got deleted before notification' do context 'got deleted before notification' do
subject { described_class.new_epic_email(recipient.id, 0) } subject { described_class.new_epic_email(recipient.id, 0) }
......
...@@ -958,9 +958,6 @@ msgstr "" ...@@ -958,9 +958,6 @@ msgstr ""
msgid "%{usage_ping_link_start}Learn more%{usage_ping_link_end} about what information is shared with GitLab Inc." msgid "%{usage_ping_link_start}Learn more%{usage_ping_link_end} about what information is shared with GitLab Inc."
msgstr "" msgstr ""
msgid "%{userLinkStart}%{user}%{linkEnd} created a %{mrLinkStart}merge request%{linkEnd}:"
msgstr ""
msgid "%{userName} (cannot merge)" msgid "%{userName} (cannot merge)"
msgstr "" msgstr ""
...@@ -976,6 +973,15 @@ msgstr "" ...@@ -976,6 +973,15 @@ msgstr ""
msgid "%{username}'s avatar" msgid "%{username}'s avatar"
msgstr "" msgstr ""
msgid "%{user} created a merge request: %{mr_link}"
msgstr ""
msgid "%{user} created an epic: %{epic_link}"
msgstr ""
msgid "%{user} created an issue: %{issue_link}"
msgstr ""
msgid "%{value} s" msgid "%{value} s"
msgstr "" msgstr ""
......
...@@ -118,7 +118,7 @@ RSpec.describe Notify do ...@@ -118,7 +118,7 @@ RSpec.describe Notify do
it 'contains a link to issue author' do it 'contains a link to issue author' do
is_expected.to have_body_text(issue.author_name) is_expected.to have_body_text(issue.author_name)
is_expected.to have_body_text 'created an issue' is_expected.to have_body_text 'created an issue:'
is_expected.to have_link(issue.to_reference, href: project_issue_url(issue.project, issue)) is_expected.to have_link(issue.to_reference, href: project_issue_url(issue.project, issue))
end end
...@@ -356,11 +356,11 @@ RSpec.describe Notify do ...@@ -356,11 +356,11 @@ RSpec.describe Notify do
it 'contains a link to merge request author' do it 'contains a link to merge request author' do
is_expected.to have_body_text merge_request.author_name is_expected.to have_body_text merge_request.author_name
is_expected.to have_body_text 'created a' is_expected.to have_body_text 'created a merge request:'
end end
it 'contains a link to the merge request url' do it 'contains a link to the merge request url' do
is_expected.to have_link('merge request', href: project_merge_request_url(merge_request.target_project, merge_request)) is_expected.to have_link(merge_request.to_reference, href: project_merge_request_url(merge_request.target_project, merge_request))
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