Update "proposal" 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:25:29 +01:00
committed by Javi Martín
parent a36f3feb87
commit 478ac3a952
6 changed files with 9 additions and 8 deletions

View File

@@ -62,6 +62,7 @@ class Mailer < ApplicationMailer
def proposal_notification_digest(user, notifications) def proposal_notification_digest(user, notifications)
@notifications = notifications @notifications = notifications
@email_to = user.email @email_to = user.email
manage_subscriptions_token(user)
with_user(user) do with_user(user) do
mail(to: @email_to, subject: t("mailers.proposal_notification_digest.title", org_name: Setting["org_name"])) mail(to: @email_to, subject: t("mailers.proposal_notification_digest.title", org_name: Setting["org_name"]))

View File

@@ -70,9 +70,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.proposal_notification_digest.unsubscribe", <%= sanitize(t("mailers.proposal_notification_digest.unsubscribe_text",
account: link_to(t("mailers.proposal_notification_digest.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>

View File

@@ -28,8 +28,7 @@ en:
title: "Proposal notifications in %{org_name}" title: "Proposal notifications in %{org_name}"
share: Share proposal share: Share proposal
comment: Comment proposal comment: Comment proposal
unsubscribe: "If you don't want to receive any proposal notifications, visit %{account} and uncheck 'Receive a summary of proposal notifications'." unsubscribe_text: "If you don't want to receive any proposal notifications, visit %{notifications} and uncheck 'Receive a summary of proposal notifications'."
unsubscribe_account: My account
unfollow: "Visit this proposal and unfollow it to stop receiving notifications." unfollow: "Visit this proposal and unfollow it to stop receiving notifications."
direct_message_for_receiver: direct_message_for_receiver:
subject: "You have received a new private message" subject: "You have received a new private message"

View File

@@ -28,8 +28,7 @@ es:
title: "Notificaciones de propuestas en %{org_name}" title: "Notificaciones de propuestas en %{org_name}"
share: Compartir propuesta share: Compartir propuesta
comment: Comentar propuesta comment: Comentar propuesta
unsubscribe: "Si no quieres recibir notificaciones de propuestas, puedes entrar en %{account} y desmarcar la opción 'Recibir resumen de notificaciones sobre propuestas'." unsubscribe_text: "Si no quieres recibir notificaciones de propuestas, puedes entrar en %{notifications} y desmarcar la opción 'Recibir resumen de notificaciones sobre propuestas'."
unsubscribe_account: Mi cuenta
unfollow: "Si no quieres recibir más notificaciones, visita esta propuesta y deja de seguirla." unfollow: "Si no quieres recibir más notificaciones, visita esta propuesta y deja de seguirla."
direct_message_for_receiver: direct_message_for_receiver:
subject: "Has recibido un nuevo mensaje privado" subject: "Has recibido un nuevo mensaje privado"

View File

@@ -92,6 +92,7 @@ describe "System Emails" do
href: proposal_url(proposal_b, anchor: "tab-notifications", host: app_host)) href: proposal_url(proposal_b, anchor: "tab-notifications", host: app_host))
expect(page).to have_content("Proposal A Notification Body") expect(page).to have_content("Proposal A Notification Body")
expect(page).to have_content("Proposal B Notification Body") expect(page).to have_content("Proposal B Notification Body")
expect(page).to have_link "Notifications"
end end
scenario "#budget_investment_created" do scenario "#budget_investment_created" do

View File

@@ -303,7 +303,7 @@ describe "Emails" do
expect(email).to have_body_text(proposal2.author.name) expect(email).to have_body_text(proposal2.author.name)
expect(email).not_to have_body_text(proposal3.title) expect(email).not_to have_body_text(proposal3.title)
expect(email).to have_body_text(/#{account_path}/) expect(email).to have_body_text(edit_subscriptions_path(token: user.subscriptions_token))
expect(email).to have_body_text("Visit this proposal and unfollow it to stop receiving notifications.") expect(email).to have_body_text("Visit this proposal and unfollow it to stop receiving notifications.")
notification1.reload notification1.reload