Update "newsletter" notification email to add unsubscribe link
This commit is contained in:
@@ -120,6 +120,7 @@ class Mailer < ApplicationMailer
|
||||
def newsletter(newsletter, recipient_email)
|
||||
@newsletter = newsletter
|
||||
@email_to = recipient_email
|
||||
manage_subscriptions_token(User.find_by(email: @email_to))
|
||||
|
||||
mail(to: @email_to, from: @newsletter.from, subject: @newsletter.subject)
|
||||
end
|
||||
|
||||
@@ -2,4 +2,15 @@
|
||||
<p style="font-family: 'Open Sans','Helvetica Neue',arial,sans-serif;font-size: 14px;line-height: 24px;">
|
||||
<%= auto_link_already_sanitized_html wysiwyg(@newsletter.body) %>
|
||||
</p>
|
||||
|
||||
<p style="font-family: 'Open Sans','Helvetica Neue',arial,sans-serif;font-size: 12px;font-weight: normal;line-height: 20px;">
|
||||
<%= 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(:newsletter)
|
||||
)) %>
|
||||
</p>
|
||||
</td>
|
||||
|
||||
@@ -8,7 +8,6 @@ en:
|
||||
subject: Someone has commented on your %{commentable}
|
||||
title: New comment
|
||||
config:
|
||||
manage_email_subscriptions: To stop receiving these emails change your settings in
|
||||
notifications_link: Notifications
|
||||
unsubscribe_text: 'To unsubscribe from these emails, visit %{notifications} and uncheck "%{notification}".'
|
||||
email_verification:
|
||||
|
||||
@@ -8,7 +8,6 @@ es:
|
||||
subject: Alguien ha comentado en tu %{commentable}
|
||||
title: Nuevo comentario
|
||||
config:
|
||||
manage_email_subscriptions: Puedes dejar de recibir estos emails cambiando tu configuración en
|
||||
notifications_link: Notificaciones
|
||||
unsubscribe_text: 'Para darse de baja de estos emails, puedes entrar en %{notifications} y desmarcar la opción "%{notification}".'
|
||||
email_verification:
|
||||
|
||||
@@ -502,6 +502,10 @@ describe "Emails" do
|
||||
expect(email).to have_subject("This is a different subject")
|
||||
expect(email).to deliver_from("no-reply@consul.dev")
|
||||
expect(email.body.encoded).to include("This is a different body")
|
||||
expect(email).to have_body_text("To unsubscribe from these emails, visit")
|
||||
expect(email).to have_body_text(
|
||||
edit_subscriptions_path(token: user_with_newsletter_in_segment_2.subscriptions_token))
|
||||
expect(email).to have_body_text('and uncheck "Receive by email website relevant information"')
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user