mirror of
https://github.com/mastodon/mastodon.git
synced 2026-07-28 12:37:26 -05:00
Rely on normalization from scope in report service (#39755)
This commit is contained in:
parent
4f1e66dc7d
commit
e558c484ee
|
|
@ -84,19 +84,18 @@ class ReportService < BaseService
|
|||
return AccountStatusesFilter.new(@target_account, @source_account).results.with_discarded.find(Array(@status_ids)).pluck(:id) if @source_account.local?
|
||||
|
||||
# If the account making reports is remote, it is likely anonymized so we have to relax the requirements for attaching statuses.
|
||||
domain = @source_account.domain.to_s.downcase
|
||||
has_followers = @target_account.followers.with_domain(domain).exists?
|
||||
has_followers = @target_account.followers.with_domain(@source_account.domain).exists?
|
||||
visibility = has_followers ? %i(public unlisted private) : %i(public unlisted)
|
||||
scope = @target_account.statuses.with_discarded
|
||||
scope.merge!(scope.where(visibility: visibility).or(scope.where(domain_mentions(domain))))
|
||||
scope.merge!(scope.where(visibility: visibility).or(scope.where(domain_mentions)))
|
||||
# Allow missing posts to not drop reports that include e.g. a deleted post
|
||||
scope.where(id: Array(@status_ids)).pluck(:id)
|
||||
end
|
||||
|
||||
def domain_mentions(domain)
|
||||
def domain_mentions
|
||||
Mention
|
||||
.joins(:account)
|
||||
.merge(Account.with_domain(domain))
|
||||
.merge(Account.with_domain(@source_account.domain))
|
||||
.select(1).arel.exists
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user