1
0
Fork 0
mirror of https://github.com/mastodon/mastodon.git synced 2024-08-20 21:08:15 -07:00

Autoflag as spam is status contains url from blocked email domains

This commit is contained in:
Robert George 2023-05-14 13:31:47 -07:00
parent 713d217384
commit 3377d00a65
No known key found for this signature in database
GPG key ID: 9B0D835A293663C4

View file

@ -78,6 +78,15 @@ class FetchLinkCardService < BaseService
links.filter_map { |a| Addressable::URI.parse(a['href']) unless skip_link?(a) }.filter_map(&:normalize) links.filter_map { |a| Addressable::URI.parse(a['href']) unless skip_link?(a) }.filter_map(&:normalize)
end end
url_hosts = urls.map(&:host)
unless EmailDomainBlock.where(domain: url_hosts).empty?
@report = ReportService.new.call(
Account.representative,
@status.account,
comment: 'Automatically flagged for malicious or spam link', category: :spam, forward: false, status_ids: [@status.id]
)
end
urls.reject { |uri| bad_url?(uri) }.first urls.reject { |uri| bad_url?(uri) }.first
end end