Update "reply" notification email to add unsubscribe link

We modified the link that previously redirected us to the "My content"
page to redirect us to the new page for managing subscriptions.

We also adapted the existing generic text by adding a description of
the related notification.
This commit is contained in:
taitus
2020-12-29 12:27:35 +01:00
committed by Javi Martín
parent 3a2564a92d
commit 1fcbd49448
4 changed files with 18 additions and 5 deletions

View File

@@ -20,6 +20,7 @@ class Mailer < ApplicationMailer
def reply(reply)
@email = ReplyEmail.new(reply)
@email_to = @email.to
manage_subscriptions_token(@email.recipient)
with_user(@email.recipient) do
mail(to: @email_to, subject: @email.subject) if @email.can_be_sent?

View File

@@ -18,6 +18,13 @@
</div>
<p style="font-family: 'Open Sans','Helvetica Neue',arial,sans-serif;font-size: 12px;font-weight: normal;line-height: 20px;">
<%= t("mailers.config.manage_email_subscriptions") %> <%= link_to t("account.show.title"), account_url, style: "color: #2895F1; text-decoration:none;" %>
<%= sanitize(t("mailers.config.unsubscribe_text",
notifications: link_to(
t("mailers.config.notifications_link"),
edit_subscriptions_url(token: @token),
style: "color: #2895F1; text-decoration: none;"
),
notification: User.human_attribute_name(:email_on_comment_reply)
)) %>
</p>
</td>

View File

@@ -176,6 +176,9 @@ describe "System Emails" do
expect(page).to have_content reply.body
expect(page).to have_link "Let's do...", href: comment_url(reply, host: app_host)
expect(page).to have_link("Notifications",
href: edit_subscriptions_url(token: user.subscriptions_token,
host: app_host))
end
scenario "#direct_message_for_receiver" do

View File

@@ -198,8 +198,9 @@ describe "Emails" do
expect(email).to deliver_to(user)
expect(email).not_to have_body_text(debate_path(debate))
expect(email).to have_body_text(comment_path(Comment.last))
expect(email).to have_body_text("To stop receiving these emails change your settings in")
expect(email).to have_body_text(account_path)
expect(email).to have_body_text("To unsubscribe from these emails, visit")
expect(email).to have_body_text(edit_subscriptions_path(token: user.subscriptions_token))
expect(email).to have_body_text('and uncheck "Notify me by email when someone replies to my comments"')
end
scenario "Do not send email about own replies to own comments" do
@@ -469,8 +470,9 @@ describe "Emails" do
expect(email).to deliver_to(user1)
expect(email).not_to have_body_text(poll_path(poll))
expect(email).to have_body_text(comment_path(Comment.last))
expect(email).to have_body_text("To stop receiving these emails change your settings in")
expect(email).to have_body_text(account_path)
expect(email).to have_body_text("To unsubscribe from these emails, visit")
expect(email).to have_body_text(edit_subscriptions_path(token: user1.subscriptions_token))
expect(email).to have_body_text('and uncheck "Notify me by email when someone replies to my comments"')
end
end