Merge remote-tracking branch 'parent/main' into upstream-20231124

This commit is contained in:
KMY 2023-11-24 09:07:40 +09:00
commit c5e4020922
206 changed files with 1987 additions and 965 deletions

View file

@ -83,12 +83,14 @@ RSpec.describe AdminMailer do
describe '.new_trends' do
let(:recipient) { Fabricate(:account, username: 'Snurf') }
let(:links) { [] }
let(:statuses) { [] }
let(:tags) { [] }
let(:mail) { described_class.with(recipient: recipient).new_trends(links, tags, statuses) }
let(:link) { Fabricate(:preview_card, trendable: true, language: 'en') }
let(:status) { Fabricate(:status) }
let(:tag) { Fabricate(:tag) }
let(:mail) { described_class.with(recipient: recipient).new_trends([link], [tag], [status]) }
before do
PreviewCardTrend.create!(preview_card: link)
StatusTrend.create!(status: status, account: Fabricate(:account))
recipient.user.update(locale: :en)
end
@ -99,6 +101,9 @@ RSpec.describe AdminMailer do
.and(deliver_from('notifications@localhost'))
.and(have_subject('New trends up for review on cb6e6126.ngrok.io'))
.and(have_body_text('The following items need a review before they can be displayed publicly'))
.and(have_body_text(ActivityPub::TagManager.instance.url_for(status)))
.and(have_body_text(link.title))
.and(have_body_text(tag.display_name))
end
end

View file

@ -3,6 +3,16 @@
# Preview all emails at http://localhost:3000/rails/mailers/admin_mailer
class AdminMailerPreview < ActionMailer::Preview
# Preview this email at http://localhost:3000/rails/mailers/admin_mailer/new_report
def new_report
AdminMailer.with(recipient: Account.first).new_report(Report.first)
end
# Preview this email at http://localhost:3000/rails/mailers/admin_mailer/new_appeal
def new_appeal
AdminMailer.with(recipient: Account.first).new_appeal(Appeal.first)
end
# Preview this email at http://localhost:3000/rails/mailers/admin_mailer/new_pending_account
def new_pending_account
AdminMailer.with(recipient: Account.first).new_pending_account(User.pending.first)
@ -18,8 +28,13 @@ class AdminMailerPreview < ActionMailer::Preview
AdminMailer.with(recipient: Account.first).new_trends(PreviewCard.joins(:trend).limit(3), Tag.limit(3), Status.joins(:trend).where(reblog_of_id: nil).limit(3))
end
# Preview this email at http://localhost:3000/rails/mailers/admin_mailer/new_appeal
def new_appeal
AdminMailer.with(recipient: Account.first).new_appeal(Appeal.first)
# Preview this email at http://localhost:3000/rails/mailers/admin_mailer/new_software_updates
def new_software_updates
AdminMailer.with(recipient: Account.first).new_software_updates
end
# Preview this email at http://localhost:3000/rails/mailers/admin_mailer/new_critical_software_updates
def new_critical_software_updates
AdminMailer.with(recipient: Account.first).new_critical_software_updates
end
end