From 1e27ab088514e9eb013abba5a6f8d580c53f74f1 Mon Sep 17 00:00:00 2001 From: Claire Date: Tue, 14 Oct 2025 13:48:51 +0200 Subject: [PATCH] Fix moderation warning e-mails that include posts (#36462) --- app/views/notification_mailer/_nested_quote.html.haml | 2 +- app/views/notification_mailer/_status.html.haml | 4 ++-- spec/mailers/user_mailer_spec.rb | 4 +++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/views/notification_mailer/_nested_quote.html.haml b/app/views/notification_mailer/_nested_quote.html.haml index e66736399..dc0921c2e 100644 --- a/app/views/notification_mailer/_nested_quote.html.haml +++ b/app/views/notification_mailer/_nested_quote.html.haml @@ -11,7 +11,7 @@ %table.email-w-full{ cellspacing: 0, cellpadding: 0, border: 0, role: 'presentation' } %tr %td.email-status-content - = render 'status_content', status: status + = render 'notification_mailer/status_content', status: status %p.email-status-footer = link_to l(status.created_at.in_time_zone(time_zone.presence), format: :with_time_zone), web_url("@#{status.account.pretty_acct}/#{status.id}") diff --git a/app/views/notification_mailer/_status.html.haml b/app/views/notification_mailer/_status.html.haml index 064709e7d..c56c7ec72 100644 --- a/app/views/notification_mailer/_status.html.haml +++ b/app/views/notification_mailer/_status.html.haml @@ -11,12 +11,12 @@ %table.email-w-full{ cellspacing: 0, cellpadding: 0, border: 0, role: 'presentation' } %tr %td.email-status-content - = render 'status_content', status: status + = render 'notification_mailer/status_content', status: status - if status.local? && status.quote %table.email-inner-card-table{ cellspacing: 0, cellpadding: 0, border: 0, role: 'presentation' } %tr %td.email-inner-nested-card-td - = render 'nested_quote', status: status.quote.quoted_status, time_zone: time_zone + = render 'notification_mailer/nested_quote', status: status.quote.quoted_status, time_zone: time_zone %p.email-status-footer = link_to l(status.created_at.in_time_zone(time_zone.presence), format: :with_time_zone), web_url("@#{status.account.pretty_acct}/#{status.id}") diff --git a/spec/mailers/user_mailer_spec.rb b/spec/mailers/user_mailer_spec.rb index 88f9d12ca..82021cd3d 100644 --- a/spec/mailers/user_mailer_spec.rb +++ b/spec/mailers/user_mailer_spec.rb @@ -141,7 +141,9 @@ RSpec.describe UserMailer do end describe '#warning' do - let(:strike) { Fabricate(:account_warning, target_account: receiver.account, text: 'dont worry its just the testsuite', action: 'suspend') } + let(:status) { Fabricate(:status, account: receiver.account) } + let(:quote) { Fabricate(:quote, state: :accepted, status: status) } + let(:strike) { Fabricate(:account_warning, target_account: receiver.account, text: 'dont worry its just the testsuite', action: 'suspend', status_ids: [quote.status_id]) } let(:mail) { described_class.warning(receiver, strike) } it 'renders warning notification' do