0
0
Fork 0

Add in-app notifications for moderation actions/warnings (#30065)

This commit is contained in:
Claire 2024-04-25 19:26:05 +02:00 committed by GitHub
parent 0ec061aa8f
commit 4ef0b48b95
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 188 additions and 21 deletions

View file

@ -69,22 +69,22 @@ RSpec.describe Admin::AccountAction do
end
end
it 'creates Admin::ActionLog' do
it 'sends notification, log the action, and closes other reports', :aggregate_failures do
other_report = Fabricate(:report, target_account: target_account)
emails = []
expect do
subject
end.to change(Admin::ActionLog, :count).by 1
end
emails = capture_emails { subject }
end.to (change(Admin::ActionLog.where(action: type), :count).by 1)
.and(change { other_report.reload.action_taken? }.from(false).to(true))
it 'calls process_email!' do
allow(account_action).to receive(:process_email!)
subject
expect(account_action).to have_received(:process_email!)
end
expect(emails).to contain_exactly(
have_attributes(
to: contain_exactly(target_account.user.email)
)
)
it 'calls process_reports!' do
allow(account_action).to receive(:process_reports!)
subject
expect(account_action).to have_received(:process_reports!)
expect(LocalNotificationWorker).to have_enqueued_sidekiq_job(target_account.id, anything, 'AccountWarning', 'moderation_warning')
end
end