diff --git a/app/lib/activitypub/activity/create.rb b/app/lib/activitypub/activity/create.rb index 90ea4a13da..70b50c6d10 100644 --- a/app/lib/activitypub/activity/create.rb +++ b/app/lib/activitypub/activity/create.rb @@ -397,7 +397,9 @@ class ActivityPub::Activity::Create < ActivityPub::Activity return false if local_usernames.empty? - Account.local.exists?(username: local_usernames) + scope = Account.local.where(Account.arel_table[:username].lower.in(local_usernames.map(&:downcase))) + scope = scope.where.not('EXISTS (SELECT 1 FROM blocks WHERE account_id = accounts.id AND target_account_id = ?)', @account.id) + scope.exists? end def tombstone_exists?