Commit f6df0d53 authored by Mayra Cabrera's avatar Mayra Cabrera

Merge branch '34573-dont-split-notification-reason' into 'master'

Don't split notification_reason_text

See merge request gitlab-org/gitlab!20637
parents 691c54ad 6b17b20a
......@@ -112,20 +112,20 @@ module EmailsHelper
end
end
# "You are receiving this email because #{reason}"
# "You are receiving this email because #{reason} on #{gitlab_host}."
def notification_reason_text(reason)
string = case reason
gitlab_host = Gitlab.config.gitlab.host
case reason
when NotificationReason::OWN_ACTIVITY
'of your activity'
_("You're receiving this email because of your activity on %{host}.") % { host: gitlab_host }
when NotificationReason::ASSIGNED
'you have been assigned an item'
_("You're receiving this email because you have been assigned an item on %{host}.") % { host: gitlab_host }
when NotificationReason::MENTIONED
'you have been mentioned'
_("You're receiving this email because you have been mentioned on %{host}.") % { host: gitlab_host }
else
'of your account'
_("You're receiving this email because of your account on %{host}.") % { host: gitlab_host }
end
"#{string} on #{Gitlab.config.gitlab.host}"
end
def create_list_id_string(project, list_id_max_length = 255)
......
......@@ -20,7 +20,7 @@
#{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.
= _("You're receiving this email because %{reason}.") % { reason: notification_reason_text(@reason) }
= 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}.
......
......@@ -11,7 +11,7 @@
<% end -%>
<% end -%>
<%= "You're receiving this email because #{notification_reason_text(@reason)}." %>
<%= notification_reason_text(@reason) %>
<%= render_if_exists 'layouts/mailer/additional_text' %>
<%= text_footer_message -%>
......@@ -20306,15 +20306,21 @@ msgstr ""
msgid "You're only seeing %{startTag}other activity%{endTag} in the feed. To add a comment, switch to one of the following options."
msgstr ""
msgid "You're receiving this email because %{reason}."
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} &middot; %{help_link}"
msgstr ""
msgid "You're receiving this email because of your activity on %{host}."
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 mentioned on %{host}."
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 ""
......
......@@ -74,6 +74,28 @@ describe EmailsHelper do
end
end
describe 'notification_reason_text' do
subject { helper.notification_reason_text(reason_code) }
using RSpec::Parameterized::TableSyntax
where(:reason_code, :reason_text) do
NotificationReason::OWN_ACTIVITY | ' of your activity '
NotificationReason::ASSIGNED | ' you have been assigned an item '
NotificationReason::MENTIONED | ' you have been mentioned '
"" | ' of your account '
nil | ' of your account '
end
with_them do
it { is_expected.to start_with "You're receiving this email because" }
it { is_expected.to include reason_text }
it { is_expected.to end_with "on #{Gitlab.config.gitlab.host}." }
end
end
describe 'sanitize_name' do
context 'when name contains a valid URL string' do
it 'returns name with `.` replaced with `_` to prevent mail clients from auto-linking URLs' do
......
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