diff --git a/app/views/email_subscription_mailer/confirmation.html.haml b/app/views/email_subscription_mailer/confirmation.html.haml index 51f414349ed..c0c5ceb50df 100644 --- a/app/views/email_subscription_mailer/confirmation.html.haml +++ b/app/views/email_subscription_mailer/confirmation.html.haml @@ -17,6 +17,6 @@ - content_for :footer do %p.email-footer-p= t('email_subscription_mailer.notification.footer.reason_for_email_html', name: display_name(@subscription.account), unsubscribe_path: @unsubscribe_url) - %p.email-footer-p= t('email_subscription_mailer.notification.footer.privacy_html', domain: @instance, privacy_policy_path: privacy_policy_path) + %p.email-footer-p= t('email_subscription_mailer.notification.footer.privacy_html', domain: @instance, privacy_policy_path: privacy_policy_url) - if Setting.email_footer_text.present? %p.email-footer-p= Setting.email_footer_text diff --git a/app/views/email_subscription_mailer/notification.html.haml b/app/views/email_subscription_mailer/notification.html.haml index 24492641407..4bbbe2f3d52 100644 --- a/app/views/email_subscription_mailer/notification.html.haml +++ b/app/views/email_subscription_mailer/notification.html.haml @@ -24,6 +24,6 @@ - content_for :footer do %p.email-footer-p= t('.footer.reason_for_email_html', name: display_name(@subscription.account), unsubscribe_path: @unsubscribe_url) - %p.email-footer-p= t('.footer.privacy_html', domain: @instance, privacy_policy_path: privacy_policy_path) + %p.email-footer-p= t('.footer.privacy_html', domain: @instance, privacy_policy_path: privacy_policy_url) - if Setting.email_footer_text.present? %p.email-footer-p= Setting.email_footer_text diff --git a/spec/mailers/email_subscription_mailer_spec.rb b/spec/mailers/email_subscription_mailer_spec.rb index 4782291145b..b4f4e7e3753 100644 --- a/spec/mailers/email_subscription_mailer_spec.rb +++ b/spec/mailers/email_subscription_mailer_spec.rb @@ -3,6 +3,13 @@ require 'rails_helper' RSpec.describe EmailSubscriptionMailer do + shared_examples 'an absolute privacy policy link' do + it 'links to the privacy policy with an absolute URL' do + expect(mail.html_part.body.decoded) + .to include(%(href="#{privacy_policy_url}")) + end + end + describe '.confirmation' do let(:email_subscription) { Fabricate(:email_subscription) } let(:mail) { described_class.with(subscription: email_subscription).confirmation } @@ -15,6 +22,8 @@ RSpec.describe EmailSubscriptionMailer do subject: I18n.t('email_subscription_mailer.confirmation.subject') ) end + + it_behaves_like 'an absolute privacy policy link' end describe '.notification' do @@ -33,6 +42,8 @@ RSpec.describe EmailSubscriptionMailer do subject: I18n.t('email_subscription_mailer.notification.subject.singular', name: email_subscription.account.display_name, excerpt: statuses.first.text.truncate(17)) ) end + + it_behaves_like 'an absolute privacy policy link' end context 'with multiple statuses' do