First pass coverage addition for antispam class (#35771)

This commit is contained in:
Matt Jankowski 2025-08-14 03:57:18 -04:00 committed by Claire
commit 7a862d3308
2 changed files with 57 additions and 2 deletions

View file

@ -57,8 +57,16 @@ class Antispam
end
def report_if_needed!(account)
return if Report.unresolved.exists?(account: Account.representative, target_account: account)
return if system_reports.unresolved.exists?(target_account: account)
Report.create!(account: Account.representative, target_account: account, category: :spam, comment: 'Account automatically reported for posting a banned URL')
system_reports.create!(
category: :spam,
comment: 'Account automatically reported for posting a banned URL',
target_account: account
)
end
def system_reports
Account.representative.reports
end
end