Update "direct message" 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.
This commit is contained in:
taitus
2020-12-29 12:23:55 +01:00
committed by Javi Martín
parent 0af765a3bd
commit a36f3feb87
6 changed files with 11 additions and 7 deletions

View File

@@ -42,6 +42,7 @@ class Mailer < ApplicationMailer
@direct_message = direct_message
@receiver = @direct_message.receiver
@email_to = @receiver.email
manage_subscriptions_token(@receiver)
with_user(@receiver) do
mail(to: @email_to, subject: t("mailers.direct_message_for_receiver.subject"))

View File

@@ -26,9 +26,10 @@
<tr>
<td style="padding-left: 10px;">
<p style="font-family: 'Open Sans','Helvetica Neue',arial,sans-serif;font-size: 14px;font-weight: normal;line-height: 24px; margin: 0; font-style: italic; padding-bottom: 20px;">
<%= sanitize(t("mailers.direct_message_for_receiver.unsubscribe",
account: link_to(t("mailers.direct_message_for_receiver.unsubscribe_account"),
account_url, style: "color: #2895F1; text-decoration: none;"))) %>
<%= sanitize(t("mailers.direct_message_for_receiver.unsubscribe_text",
notifications: link_to(t("mailers.config.notifications_link"),
edit_subscriptions_url(token: @token),
style: "color: #2895F1; text-decoration: none;"))) %>
</p>
</td>
</tr>

View File

@@ -34,8 +34,7 @@ en:
direct_message_for_receiver:
subject: "You have received a new private message"
reply: Reply to %{sender}
unsubscribe: "If you don't want to receive direct messages, visit %{account} and uncheck 'Receive emails about direct messages'."
unsubscribe_account: My account
unsubscribe_text: "If you don't want to receive direct messages, visit %{notifications} and uncheck 'Receive emails about direct messages'."
direct_message_for_sender:
subject: "You have sent a new private message"
title: "You have sent a new private message to <strong>%{receiver}</strong> with the content:"

View File

@@ -34,8 +34,7 @@ es:
direct_message_for_receiver:
subject: "Has recibido un nuevo mensaje privado"
reply: Responder a %{sender}
unsubscribe: "Si no quieres recibir mensajes privados, puedes entrar en %{account} y desmarcar la opción 'Recibir emails con mensajes privados'."
unsubscribe_account: Mi cuenta
unsubscribe_text: "Si no quieres recibir mensajes privados, puedes entrar en %{notifications} y desmarcar la opción 'Recibir emails con mensajes privados'."
direct_message_for_sender:
subject: "Has enviado un nuevo mensaje privado"
title: "Has enviado un nuevo mensaje privado a <strong>%{receiver}</strong> con el siguiente contenido:"

View File

@@ -185,6 +185,9 @@ describe "System Emails" do
expect(page).to have_content "This is a sample of message's content."
expect(page).to have_link "Reply to #{admin.user.name}", href: user_url(admin.user, host: app_host)
expect(page).to have_link("Notifications",
href: edit_subscriptions_url(token: admin.user.subscriptions_token,
host: app_host))
end
scenario "#direct_message_for_sender" do

View File

@@ -243,6 +243,7 @@ describe "Emails" do
expect(email).to have_body_text(direct_message.body)
expect(email).to have_body_text(direct_message.sender.name)
expect(email).to have_body_text(/#{user_path(direct_message.sender_id)}/)
expect(email).to have_body_text(edit_subscriptions_path(token: receiver.subscriptions_token))
end
scenario "Sender email" do