Fix relative privacy policy links in subscription emails (#40486)

This commit is contained in:
Kazuki Nagasawa
2026-09-14 08:29:12 +00:00
committed by GitHub
parent 4b66795b1a
commit 1062aedf1d
3 changed files with 13 additions and 2 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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