diff --git a/app/helpers/emails_helper.rb b/app/helpers/emails_helper.rb index c23d905a0089d018d9248597f180f57d27b0834d..dca9cbd02ffb004d1a351fc2e7c38a41b17396a1 100644 --- a/app/helpers/emails_helper.rb +++ b/app/helpers/emails_helper.rb @@ -116,19 +116,16 @@ def closure_reason_text(closed_via, format: nil) end end - # "You are receiving this email because #{reason} on #{gitlab_host}." - def notification_reason_text(reason) - gitlab_host = Gitlab.config.gitlab.host - - case reason - when NotificationReason::OWN_ACTIVITY - _("You're receiving this email because of your activity on %{host}.") % { host: gitlab_host } - when NotificationReason::ASSIGNED - _("You're receiving this email because you have been assigned an item on %{host}.") % { host: gitlab_host } - when NotificationReason::MENTIONED - _("You're receiving this email because you have been mentioned on %{host}.") % { host: gitlab_host } + # "You are receiving this email because ... on #{host}. ..." + def notification_reason_text(reason: nil, show_manage_notifications_link: false, show_help_link: false, manage_label_subscriptions_url: nil, unsubscribe_url: nil, format: :text) + if unsubscribe_url && show_manage_notifications_link && show_help_link + notification_reason_text_with_unsubscribe_and_manage_notifications_and_help_links(reason: reason, unsubscribe_url: unsubscribe_url, format: format) + elsif !reason && manage_label_subscriptions_url && show_help_link + notification_reason_text_with_manage_label_subscriptions_and_help_links(manage_label_subscriptions_url: manage_label_subscriptions_url, format: format) + elsif show_manage_notifications_link && show_help_link + notification_reason_text_with_manage_notifications_and_help_links(reason: reason, format: format) else - _("You're receiving this email because of your account on %{host}.") % { host: gitlab_host } + notification_reason_text_without_links(reason: reason, format: format) end end @@ -259,9 +256,7 @@ def group_membership_expiration_changed_link(member, group, format: nil) end def instance_access_request_text(user, format: nil) - gitlab_host = Gitlab.config.gitlab.host - - _('%{username} has asked for a GitLab account on your instance %{host}:') % { username: sanitize_name(user.name), host: gitlab_host } + _('%{username} has asked for a GitLab account on your instance %{host}:').html_safe % { username: sanitize_name(user.name), host: gitlab_host_link(format) } end def instance_access_request_link(user, format: nil) @@ -317,6 +312,75 @@ def show_header? def email_header_and_footer_enabled? current_appearance&.email_header_and_footer_enabled? end + + def gitlab_host_link(format) + case format + when :html + generate_link(Gitlab.config.gitlab.host, Gitlab.config.gitlab.url) + when :text + Gitlab.config.gitlab.host + end + end + + def notification_reason_text_with_unsubscribe_and_manage_notifications_and_help_links(reason:, unsubscribe_url:, format:) + unsubscribe_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: unsubscribe_url } + unsubscribe_link_end = '</a>'.html_safe + + manage_notifications_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer" class="mng-notif-link">'.html_safe % { url: profile_notifications_url } + manage_notifications_link_end = '</a>'.html_safe + + help_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer" class="help-link">'.html_safe % { url: help_url } + help_link_end = '</a>'.html_safe + + case reason + when NotificationReason::OWN_ACTIVITY + _("You're receiving this email because of your activity on %{host}. %{unsubscribe_link_start}Unsubscribe%{unsubscribe_link_end} from this thread · %{manage_notifications_link_start}Manage all notifications%{manage_notifications_link_end} · %{help_link_start}Help%{help_link_end}").html_safe % { host: gitlab_host_link(format), unsubscribe_link_start: unsubscribe_link_start, unsubscribe_link_end: unsubscribe_link_end, manage_notifications_link_start: manage_notifications_link_start, manage_notifications_link_end: manage_notifications_link_end, help_link_start: help_link_start, help_link_end: help_link_end } + when NotificationReason::ASSIGNED + _("You're receiving this email because you have been assigned an item on %{host}. %{unsubscribe_link_start}Unsubscribe%{unsubscribe_link_end} from this thread · %{manage_notifications_link_start}Manage all notifications%{manage_notifications_link_end} · %{help_link_start}Help%{help_link_end}").html_safe % { host: gitlab_host_link(format), unsubscribe_link_start: unsubscribe_link_start, unsubscribe_link_end: unsubscribe_link_end, manage_notifications_link_start: manage_notifications_link_start, manage_notifications_link_end: manage_notifications_link_end, help_link_start: help_link_start, help_link_end: help_link_end } + when NotificationReason::MENTIONED + _("You're receiving this email because you have been mentioned on %{host}. %{unsubscribe_link_start}Unsubscribe%{unsubscribe_link_end} from this thread · %{manage_notifications_link_start}Manage all notifications%{manage_notifications_link_end} · %{help_link_start}Help%{help_link_end}").html_safe % { host: gitlab_host_link(format), unsubscribe_link_start: unsubscribe_link_start, unsubscribe_link_end: unsubscribe_link_end, manage_notifications_link_start: manage_notifications_link_start, manage_notifications_link_end: manage_notifications_link_end, help_link_start: help_link_start, help_link_end: help_link_end } + else + _("You're receiving this email because of your account on %{host}. %{unsubscribe_link_start}Unsubscribe%{unsubscribe_link_end} from this thread · %{manage_notifications_link_start}Manage all notifications%{manage_notifications_link_end} · %{help_link_start}Help%{help_link_end}").html_safe % { host: gitlab_host_link(format), unsubscribe_link_start: unsubscribe_link_start, unsubscribe_link_end: unsubscribe_link_end, manage_notifications_link_start: manage_notifications_link_start, manage_notifications_link_end: manage_notifications_link_end, help_link_start: help_link_start, help_link_end: help_link_end } + end + end + + def notification_reason_text_with_manage_label_subscriptions_and_help_links(manage_label_subscriptions_url:, format:) + manage_label_subscriptions_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer" class="mng-notif-link">'.html_safe % { url: manage_label_subscriptions_url } + manage_label_subscriptions_link_end = '</a>'.html_safe + + help_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer" class="help-link">'.html_safe % { url: help_url } + help_link_end = '</a>'.html_safe + + _("You're receiving this email because of your account on %{host}. %{manage_label_subscriptions_link_start}Manage label subscriptions%{manage_label_subscriptions_link_end} · %{help_link_start}Help%{help_link_end}").html_safe % { host: gitlab_host_link(format), manage_label_subscriptions_link_start: manage_label_subscriptions_link_start, manage_label_subscriptions_link_end: manage_label_subscriptions_link_end, help_link_start: help_link_start, help_link_end: help_link_end } + end + + def notification_reason_text_with_manage_notifications_and_help_links(reason:, format:) + manage_notifications_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer" class="mng-notif-link">'.html_safe % { url: profile_notifications_url } + manage_notifications_link_end = '</a>'.html_safe + + help_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer" class="help-link">'.html_safe % { url: help_url } + help_link_end = '</a>'.html_safe + + case reason + when NotificationReason::MENTIONED + _("You're receiving this email because you have been mentioned on %{host}. %{manage_notifications_link_start}Manage all notifications%{manage_notifications_link_end} · %{help_link_start}Help%{help_link_end}").html_safe % { host: gitlab_host_link(format), manage_notifications_link_start: manage_notifications_link_start, manage_notifications_link_end: manage_notifications_link_end, help_link_start: help_link_start, help_link_end: help_link_end } + else + _("You're receiving this email because of your account on %{host}. %{manage_notifications_link_start}Manage all notifications%{manage_notifications_link_end} · %{help_link_start}Help%{help_link_end}").html_safe % { host: gitlab_host_link(format), manage_notifications_link_start: manage_notifications_link_start, manage_notifications_link_end: manage_notifications_link_end, help_link_start: help_link_start, help_link_end: help_link_end } + end + end + + def notification_reason_text_without_links(reason:, format:) + case reason + when NotificationReason::OWN_ACTIVITY + _("You're receiving this email because of your activity on %{host}.").html_safe % { host: gitlab_host_link(format) } + when NotificationReason::ASSIGNED + _("You're receiving this email because you have been assigned an item on %{host}.").html_safe % { host: gitlab_host_link(format) } + when NotificationReason::MENTIONED + _("You're receiving this email because you have been mentioned on %{host}.").html_safe % { host: gitlab_host_link(format) } + else + _("You're receiving this email because of your account on %{host}.").html_safe % { host: gitlab_host_link(format) } + end + end end EmailsHelper.prepend_mod_with('EmailsHelper') diff --git a/app/views/layouts/mailer.html.haml b/app/views/layouts/mailer.html.haml index 580b8e67a3c0fd997b596c20a29a0825f14c4f5d..8452f0d99766a758a81170950765e087e159e429 100644 --- a/app/views/layouts/mailer.html.haml +++ b/app/views/layouts/mailer.html.haml @@ -3,8 +3,6 @@ %td %img.footer-logo{ alt: "GitLab", src: image_url('mailers/gitlab_logo_black_text.png') } %div - - manage_notifications_link = link_to(_("Manage all notifications"), profile_notifications_url, class: 'mng-notif-link') - - help_link = link_to(_("Help"), help_url, class: 'help-link') - = _("You're receiving this email because of your account on %{host}. %{manage_notifications_link} · %{help_link}").html_safe % { host: Gitlab.config.gitlab.host, manage_notifications_link: manage_notifications_link, help_link: help_link } + = notification_reason_text(show_manage_notifications_link: true, show_help_link: true, format: :html) = render 'layouts/mailer' diff --git a/app/views/layouts/mailer.text.erb b/app/views/layouts/mailer.text.erb index 1a06ea68bcd708e1f18bb12084e492995198b12c..24553734e494a92769fea1b525e31a6b91fb19d6 100644 --- a/app/views/layouts/mailer.text.erb +++ b/app/views/layouts/mailer.text.erb @@ -3,7 +3,7 @@ <%= yield -%> -- <%# signature marker %> -<%= _("You're receiving this email because of your account on %{host}.") % { host: Gitlab.config.gitlab.host } %> +<%= notification_reason_text %> <%= render_if_exists 'layouts/mailer/additional_text' %> <%= text_footer_message %> diff --git a/app/views/layouts/notify.html.haml b/app/views/layouts/notify.html.haml index d9f16a89fbc2a80d6d63d2334ce4985dac7060ad..d05b6951fbf0eb7450adafb38b81bbc2732684a2 100644 --- a/app/views/layouts/notify.html.haml +++ b/app/views/layouts/notify.html.haml @@ -26,16 +26,7 @@ - else #{link_to _("View it on GitLab"), @target_url}. %br - -# Don't link the host in the line below, one link in the email is easier to quickly click than two. - = notification_reason_text(@reason) - If you'd like to receive fewer emails, you can - - if @labels_url - adjust your #{link_to 'label subscriptions', @labels_url}. - - else - - if @unsubscribe_url - = link_to "unsubscribe", @unsubscribe_url - from this thread or - adjust your notification settings. + = notification_reason_text(reason: @reason, show_manage_notifications_link: !@labels_url, show_help_link: true, manage_label_subscriptions_url: @labels_url, unsubscribe_url: @unsubscribe_url, format: :html) = email_action @target_url diff --git a/app/views/layouts/notify.text.erb b/app/views/layouts/notify.text.erb index 49ad0b5abc5838919b5c0a58ce3d7ed85de45f5d..4eae96dc3767a126cc9c0d7780c2b9f5a7bdaa8f 100644 --- a/app/views/layouts/notify.text.erb +++ b/app/views/layouts/notify.text.erb @@ -11,7 +11,7 @@ <% end -%> <% end -%> -<%= notification_reason_text(@reason) %> +<%= notification_reason_text(reason: @reason) %> <%= render_if_exists 'layouts/mailer/additional_text' %> <%= text_footer_message -%> diff --git a/app/views/notify/approved_merge_request_email.html.haml b/app/views/notify/approved_merge_request_email.html.haml index c51fe02370de4b50bce5537c3a7f85f21339c335..28da1182d4916f0d34d5d325ff48b29ea76dd6b4 100644 --- a/app/views/notify/approved_merge_request_email.html.haml +++ b/app/views/notify/approved_merge_request_email.html.haml @@ -152,6 +152,4 @@ %td{ style: "font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;padding:25px 0;font-size:13px;line-height:1.6;color:#5c5c5c;" } %img{ alt: "GitLab", src: image_url('mailers/gitlab_logo_black_text.png'), style: "display:block;margin:0 auto 1em;", width: "90" }/ %div - - manage_notifications_link = link_to(_("Manage all notifications"), profile_notifications_url, style: "color:#3777b0;text-decoration:none;") - - help_link = link_to(_("Help"), help_url, style: "color:#3777b0;text-decoration:none;") - = _("You're receiving this email because of your account on %{host}. %{manage_notifications_link} · %{help_link}").html_safe % { host: Gitlab.config.gitlab.host, manage_notifications_link: manage_notifications_link, help_link: help_link } + = notification_reason_text(show_manage_notifications_link: true, show_help_link: true, format: :html) diff --git a/app/views/notify/merge_when_pipeline_succeeds_email.html.haml b/app/views/notify/merge_when_pipeline_succeeds_email.html.haml index 550d386c84330e594a5dba1cc0e1e93ec6c64c7f..f6b517d6e34dc4fc5ae325c417ddcb29eeef3ad3 100644 --- a/app/views/notify/merge_when_pipeline_succeeds_email.html.haml +++ b/app/views/notify/merge_when_pipeline_succeeds_email.html.haml @@ -148,6 +148,4 @@ %td{ style: "font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;padding:25px 0;font-size:13px;line-height:1.6;color:#5c5c5c;" } %img{ alt: "GitLab", src: image_url('mailers/gitlab_logo_black_text.png'), style: "display:block;margin:0 auto 1em;", width: "90" } %div - - manage_notifications_link = link_to(_("Manage all notifications"), profile_notifications_url, style: "color:#3777b0;text-decoration:none;") - - help_link = link_to(_("Help"), help_url, style: "color:#3777b0;text-decoration:none;") - = _("You're receiving this email because of your account on %{host}. %{manage_notifications_link} · %{help_link}").html_safe % { host: Gitlab.config.gitlab.host, manage_notifications_link: manage_notifications_link, help_link: help_link } + = notification_reason_text(show_manage_notifications_link: true, show_help_link: true, format: :html) diff --git a/app/views/notify/unapproved_merge_request_email.html.haml b/app/views/notify/unapproved_merge_request_email.html.haml index ae58ccd399501209f6386401e209f20e5ba5d4ee..0b8fbe1422836acc56efaf773dbb2d35bd91ab7c 100644 --- a/app/views/notify/unapproved_merge_request_email.html.haml +++ b/app/views/notify/unapproved_merge_request_email.html.haml @@ -151,6 +151,4 @@ %td{ style: "font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;padding:25px 0;font-size:13px;line-height:1.6;color:#5c5c5c;" } %img{ alt: "GitLab", src: image_url('mailers/gitlab_logo_black_text.png'), style: "display:block;margin:0 auto 1em;", width: "90" }/ %div - - manage_notifications_link = link_to(_("Manage all notifications"), profile_notifications_url, style: "color:#3777b0;text-decoration:none;") - - help_link = link_to(_("Help"), help_url, style: "color:#3777b0;text-decoration:none;") - = _("You're receiving this email because of your account on %{host}. %{manage_notifications_link} · %{help_link}").html_safe % { host: Gitlab.config.gitlab.host, manage_notifications_link: manage_notifications_link, help_link: help_link } + = notification_reason_text(show_manage_notifications_link: true, show_help_link: true, format: :html) diff --git a/ee/app/views/layouts/mailer/devise.text.erb b/ee/app/views/layouts/mailer/devise.text.erb index 9ccd3082bf03eae1b5bf0c50c27d933f6c5143da..75df7023b5d54b719dde8ca1891ef90dae2f2c45 100644 --- a/ee/app/views/layouts/mailer/devise.text.erb +++ b/ee/app/views/layouts/mailer/devise.text.erb @@ -1,5 +1,5 @@ <%= yield -%> --- -You're receiving this email because of your account on <%= Gitlab.config.gitlab.host %>. +<%= notification_reason_text %> <%# EE-specific start %><%= render 'layouts/mailer/additional_text' %><%# EE-specific end %> diff --git a/ee/spec/mailers/ee/emails/profile_spec.rb b/ee/spec/mailers/ee/emails/profile_spec.rb index 4e5ddc73e8a8adb6a2f869d6b17ad88ba0045df8..ba8f7a44c5821e413f27a3ae797942350a7f2a1f 100644 --- a/ee/spec/mailers/ee/emails/profile_spec.rb +++ b/ee/spec/mailers/ee/emails/profile_spec.rb @@ -30,7 +30,7 @@ end it 'includes the email reason' do - is_expected.to have_body_text /You're receiving this email because of your account on localhost/ + is_expected.to have_body_text %r{You're receiving this email because of your account on <a .*>localhost<\/a>} end end end diff --git a/locale/gitlab.pot b/locale/gitlab.pot index ecea30cb802a949a44842e9f73f0b919d0084b64..dd3b695e4b7c3fbf2032bdeb81d16956d3aed037 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -23441,9 +23441,6 @@ msgstr "" msgid "Manage access" msgstr "" -msgid "Manage all notifications" -msgstr "" - msgid "Manage applications that can use GitLab as an OAuth provider, and applications that you've authorized to use your account." msgstr "" @@ -44284,18 +44281,36 @@ msgstr "" msgid "You're receiving this email because of your account on %{host}." msgstr "" -msgid "You're receiving this email because of your account on %{host}. %{manage_notifications_link} · %{help_link}" +msgid "You're receiving this email because of your account on %{host}. %{manage_label_subscriptions_link_start}Manage label subscriptions%{manage_label_subscriptions_link_end} · %{help_link_start}Help%{help_link_end}" +msgstr "" + +msgid "You're receiving this email because of your account on %{host}. %{manage_notifications_link_start}Manage all notifications%{manage_notifications_link_end} · %{help_link_start}Help%{help_link_end}" +msgstr "" + +msgid "You're receiving this email because of your account on %{host}. %{unsubscribe_link_start}Unsubscribe%{unsubscribe_link_end} from this thread · %{manage_notifications_link_start}Manage all notifications%{manage_notifications_link_end} · %{help_link_start}Help%{help_link_end}" msgstr "" msgid "You're receiving this email because of your activity on %{host}." msgstr "" +msgid "You're receiving this email because of your activity on %{host}. %{unsubscribe_link_start}Unsubscribe%{unsubscribe_link_end} from this thread · %{manage_notifications_link_start}Manage all notifications%{manage_notifications_link_end} · %{help_link_start}Help%{help_link_end}" +msgstr "" + msgid "You're receiving this email because you have been assigned an item on %{host}." msgstr "" +msgid "You're receiving this email because you have been assigned an item on %{host}. %{unsubscribe_link_start}Unsubscribe%{unsubscribe_link_end} from this thread · %{manage_notifications_link_start}Manage all notifications%{manage_notifications_link_end} · %{help_link_start}Help%{help_link_end}" +msgstr "" + msgid "You're receiving this email because you have been mentioned on %{host}." msgstr "" +msgid "You're receiving this email because you have been mentioned on %{host}. %{manage_notifications_link_start}Manage all notifications%{manage_notifications_link_end} · %{help_link_start}Help%{help_link_end}" +msgstr "" + +msgid "You're receiving this email because you have been mentioned on %{host}. %{unsubscribe_link_start}Unsubscribe%{unsubscribe_link_end} from this thread · %{manage_notifications_link_start}Manage all notifications%{manage_notifications_link_end} · %{help_link_start}Help%{help_link_end}" +msgstr "" + msgid "You've already enabled two-factor authentication using one time password authenticators. In order to register a different device, you must first disable two-factor authentication." msgstr "" diff --git a/spec/features/unsubscribe_links_spec.rb b/spec/features/unsubscribe_links_spec.rb index 3fe276ce1621ff45403e1a8da6a708573ca6bb72..5317f5863901f5deb05bdcd4bd118e65fc00ebc7 100644 --- a/spec/features/unsubscribe_links_spec.rb +++ b/spec/features/unsubscribe_links_spec.rb @@ -14,7 +14,7 @@ let(:mail) { ActionMailer::Base.deliveries.last } let(:body) { Capybara::Node::Simple.new(mail.default_part_body.to_s) } let(:header_link) { mail.header['List-Unsubscribe'].to_s[1..-2] } # Strip angle brackets - let(:body_link) { body.find_link('unsubscribe')['href'] } + let(:body_link) { body.find_link('Unsubscribe')['href'] } before do perform_enqueued_jobs { issue } diff --git a/spec/helpers/emails_helper_spec.rb b/spec/helpers/emails_helper_spec.rb index 220e154aad85b68dc1a42d33bf9bd2fc398ccc93..04653d9ff033d113df46f78a96436ad0a84dc10e 100644 --- a/spec/helpers/emails_helper_spec.rb +++ b/spec/helpers/emails_helper_spec.rb @@ -77,7 +77,7 @@ end describe 'notification_reason_text' do - subject { helper.notification_reason_text(reason_code) } + subject { helper.notification_reason_text(reason: reason_code) } using RSpec::Parameterized::TableSyntax diff --git a/spec/mailers/emails/admin_notification_spec.rb b/spec/mailers/emails/admin_notification_spec.rb index a233be86a83dce1bf03b8c3b8a7a3735c40824c2..02ccbeb6c51a13f015be18faae2843a2410fde85 100644 --- a/spec/mailers/emails/admin_notification_spec.rb +++ b/spec/mailers/emails/admin_notification_spec.rb @@ -58,7 +58,7 @@ end it 'includes the email reason' do - is_expected.to have_body_text "You're receiving this email because of your account on localhost" + is_expected.to have_body_text %r{You're receiving this email because of your account on <a .*>localhost<\/a>} end end end diff --git a/spec/mailers/emails/profile_spec.rb b/spec/mailers/emails/profile_spec.rb index f4483f7e8f5c7b3ef73e8110ea66b0e968d17c93..09ed27eb90fe9e85d08cd37b155506f209139815 100644 --- a/spec/mailers/emails/profile_spec.rb +++ b/spec/mailers/emails/profile_spec.rb @@ -151,7 +151,7 @@ end it 'includes the email reason' do - is_expected.to have_body_text /You're receiving this email because of your account on localhost/ + is_expected.to have_body_text %r{You're receiving this email because of your account on <a .*>localhost<\/a>} end end end @@ -187,7 +187,7 @@ end it 'includes the email reason' do - is_expected.to have_body_text /You're receiving this email because of your account on localhost/ + is_expected.to have_body_text %r{You're receiving this email because of your account on <a .*>localhost<\/a>} end context 'with User does not exist' do @@ -222,7 +222,7 @@ end it 'includes the email reason' do - is_expected.to have_body_text /You're receiving this email because of your account on localhost/ + is_expected.to have_body_text %r{You're receiving this email because of your account on <a .*>localhost<\/a>} end end @@ -266,7 +266,7 @@ end shared_examples 'includes the email reason' do - it { is_expected.to have_body_text /You're receiving this email because of your account on localhost/ } + it { is_expected.to have_body_text %r{You're receiving this email because of your account on <a .*>localhost<\/a>} } end shared_examples 'valid use case' do diff --git a/spec/mailers/notify_spec.rb b/spec/mailers/notify_spec.rb index a9796c28870b64f57ff9df206574e3252d1c0124..7f0bb70db7df8da8b5150f7bf424cc9969fea0ea 100644 --- a/spec/mailers/notify_spec.rb +++ b/spec/mailers/notify_spec.rb @@ -7,6 +7,7 @@ include EmailSpec::Helpers include EmailSpec::Matchers include EmailHelpers + include EmailsHelper include RepoHelpers include MembersHelper @@ -396,7 +397,7 @@ end end - context 'when sent with a reason' do + context 'when sent with a reason', type: :helper do subject { described_class.reassigned_merge_request_email(recipient.id, merge_request.id, [previous_assignee.id], current_user.id, NotificationReason::ASSIGNED) } it_behaves_like 'appearance header and footer enabled' @@ -407,15 +408,15 @@ end it 'includes the reason in the footer' do - text = EmailsHelper.instance_method(:notification_reason_text).bind(self).call(NotificationReason::ASSIGNED) + text = EmailsHelper.instance_method(:notification_reason_text).bind(self).call(reason: NotificationReason::ASSIGNED, format: :html) is_expected.to have_body_text(text) new_subject = described_class.reassigned_merge_request_email(recipient.id, merge_request.id, [previous_assignee.id], current_user.id, NotificationReason::MENTIONED) - text = EmailsHelper.instance_method(:notification_reason_text).bind(self).call(NotificationReason::MENTIONED) + text = EmailsHelper.instance_method(:notification_reason_text).bind(self).call(reason: NotificationReason::MENTIONED, format: :html) expect(new_subject).to have_body_text(text) new_subject = described_class.reassigned_merge_request_email(recipient.id, merge_request.id, [previous_assignee.id], current_user.id, nil) - text = EmailsHelper.instance_method(:notification_reason_text).bind(self).call(nil) + text = EmailsHelper.instance_method(:notification_reason_text).bind(self).call(format: :html) expect(new_subject).to have_body_text(text) end end