diff --git a/app/mailers/mailer.rb b/app/mailers/mailer.rb index 17440bec2..73e8fa903 100644 --- a/app/mailers/mailer.rb +++ b/app/mailers/mailer.rb @@ -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")) diff --git a/app/views/mailer/direct_message_for_receiver.html.erb b/app/views/mailer/direct_message_for_receiver.html.erb index b563ce621..ae9637d3e 100644 --- a/app/views/mailer/direct_message_for_receiver.html.erb +++ b/app/views/mailer/direct_message_for_receiver.html.erb @@ -26,9 +26,10 @@

- <%= 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;"))) %>

diff --git a/config/locales/en/mailers.yml b/config/locales/en/mailers.yml index d8d5f05fd..1960ca558 100644 --- a/config/locales/en/mailers.yml +++ b/config/locales/en/mailers.yml @@ -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 %{receiver} with the content:" diff --git a/config/locales/es/mailers.yml b/config/locales/es/mailers.yml index d45c500c7..961c88b96 100644 --- a/config/locales/es/mailers.yml +++ b/config/locales/es/mailers.yml @@ -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 %{receiver} con el siguiente contenido:" diff --git a/spec/system/admin/system_emails_spec.rb b/spec/system/admin/system_emails_spec.rb index 7786631f7..1d8d8fca9 100644 --- a/spec/system/admin/system_emails_spec.rb +++ b/spec/system/admin/system_emails_spec.rb @@ -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 diff --git a/spec/system/emails_spec.rb b/spec/system/emails_spec.rb index 87ccada2a..a77863432 100644 --- a/spec/system/emails_spec.rb +++ b/spec/system/emails_spec.rb @@ -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