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:
@@ -42,6 +42,7 @@ class Mailer < ApplicationMailer
|
|||||||
@direct_message = direct_message
|
@direct_message = direct_message
|
||||||
@receiver = @direct_message.receiver
|
@receiver = @direct_message.receiver
|
||||||
@email_to = @receiver.email
|
@email_to = @receiver.email
|
||||||
|
manage_subscriptions_token(@receiver)
|
||||||
|
|
||||||
with_user(@receiver) do
|
with_user(@receiver) do
|
||||||
mail(to: @email_to, subject: t("mailers.direct_message_for_receiver.subject"))
|
mail(to: @email_to, subject: t("mailers.direct_message_for_receiver.subject"))
|
||||||
|
|||||||
@@ -26,9 +26,10 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td style="padding-left: 10px;">
|
<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;">
|
<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",
|
<%= sanitize(t("mailers.direct_message_for_receiver.unsubscribe_text",
|
||||||
account: link_to(t("mailers.direct_message_for_receiver.unsubscribe_account"),
|
notifications: link_to(t("mailers.config.notifications_link"),
|
||||||
account_url, style: "color: #2895F1; text-decoration: none;"))) %>
|
edit_subscriptions_url(token: @token),
|
||||||
|
style: "color: #2895F1; text-decoration: none;"))) %>
|
||||||
</p>
|
</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -34,8 +34,7 @@ en:
|
|||||||
direct_message_for_receiver:
|
direct_message_for_receiver:
|
||||||
subject: "You have received a new private message"
|
subject: "You have received a new private message"
|
||||||
reply: Reply to %{sender}
|
reply: Reply to %{sender}
|
||||||
unsubscribe: "If you don't want to receive direct messages, visit %{account} and uncheck 'Receive emails about direct messages'."
|
unsubscribe_text: "If you don't want to receive direct messages, visit %{notifications} and uncheck 'Receive emails about direct messages'."
|
||||||
unsubscribe_account: My account
|
|
||||||
direct_message_for_sender:
|
direct_message_for_sender:
|
||||||
subject: "You have sent a new private message"
|
subject: "You have sent a new private message"
|
||||||
title: "You have sent a new private message to <strong>%{receiver}</strong> with the content:"
|
title: "You have sent a new private message to <strong>%{receiver}</strong> with the content:"
|
||||||
|
|||||||
@@ -34,8 +34,7 @@ es:
|
|||||||
direct_message_for_receiver:
|
direct_message_for_receiver:
|
||||||
subject: "Has recibido un nuevo mensaje privado"
|
subject: "Has recibido un nuevo mensaje privado"
|
||||||
reply: Responder a %{sender}
|
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_text: "Si no quieres recibir mensajes privados, puedes entrar en %{notifications} y desmarcar la opción 'Recibir emails con mensajes privados'."
|
||||||
unsubscribe_account: Mi cuenta
|
|
||||||
direct_message_for_sender:
|
direct_message_for_sender:
|
||||||
subject: "Has enviado un nuevo mensaje privado"
|
subject: "Has enviado un nuevo mensaje privado"
|
||||||
title: "Has enviado un nuevo mensaje privado a <strong>%{receiver}</strong> con el siguiente contenido:"
|
title: "Has enviado un nuevo mensaje privado a <strong>%{receiver}</strong> con el siguiente contenido:"
|
||||||
|
|||||||
@@ -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_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 "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
|
end
|
||||||
|
|
||||||
scenario "#direct_message_for_sender" do
|
scenario "#direct_message_for_sender" do
|
||||||
|
|||||||
@@ -243,6 +243,7 @@ describe "Emails" do
|
|||||||
expect(email).to have_body_text(direct_message.body)
|
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(direct_message.sender.name)
|
||||||
expect(email).to have_body_text(/#{user_path(direct_message.sender_id)}/)
|
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
|
end
|
||||||
|
|
||||||
scenario "Sender email" do
|
scenario "Sender email" do
|
||||||
|
|||||||
Reference in New Issue
Block a user