Revert "Add block from bot follow settings"

This reverts commit ff994d78fa.
This commit is contained in:
KMY 2023-09-18 21:33:05 +09:00
parent ff994d78fa
commit cfa250421e
12 changed files with 13 additions and 208 deletions

View file

@ -30,7 +30,7 @@ class ActivityPub::Activity::Follow < ActivityPub::Activity
follow_request = FollowRequest.create!(account: @account, target_account: target_account, uri: @json['id'])
if target_account.locked? || @account.silenced? || block_straight_follow? || (@account.bot? && target_account.user&.setting_lock_follow_from_bot)
if target_account.locked? || @account.silenced? || block_straight_follow?
LocalNotificationWorker.perform_async(target_account.id, follow_request.id, 'FollowRequest', 'follow_request')
else
AuthorizeFollowService.new.call(@account, target_account)

View file

@ -30,9 +30,9 @@ class StatusReachFinder
if @status.reblog?
[]
elsif @status.limited_visibility?
expect_bot_query(Account.where(id: mentioned_account_ids).where.not(domain: banned_domains)).inboxes
Account.where(id: mentioned_account_ids).where.not(domain: banned_domains).inboxes
else
expect_bot_query(Account.where(id: reached_account_ids).where.not(domain: banned_domains)).inboxes
Account.where(id: reached_account_ids).where.not(domain: banned_domains).inboxes
end
end
@ -40,9 +40,9 @@ class StatusReachFinder
if @status.reblog?
[]
elsif @status.limited_visibility?
expect_bot_query(Account.where(id: mentioned_account_ids).where(domain: banned_domains_for_misskey)).inboxes
Account.where(id: mentioned_account_ids).where(domain: banned_domains_for_misskey).inboxes
else
expect_bot_query(Account.where(id: reached_account_ids).where(domain: banned_domains_for_misskey)).inboxes
Account.where(id: reached_account_ids).where(domain: banned_domains_for_misskey).inboxes
end
end
@ -90,25 +90,21 @@ class StatusReachFinder
def followers_inboxes
if @status.in_reply_to_local_account? && distributable?
scope = @status.account.followers.or(@status.thread.account.followers.not_domain_blocked_by_account(@status.account)).where.not(domain: banned_domains)
expect_bot_query(scope).inboxes
@status.account.followers.or(@status.thread.account.followers.not_domain_blocked_by_account(@status.account)).where.not(domain: banned_domains).inboxes
elsif @status.direct_visibility? || @status.limited_visibility?
[]
else
scope = @status.account.followers.where.not(domain: banned_domains)
expect_bot_query(scope).inboxes
@status.account.followers.where.not(domain: banned_domains).inboxes
end
end
def followers_inboxes_for_misskey
if @status.in_reply_to_local_account? && distributable?
scope = @status.account.followers.or(@status.thread.account.followers.not_domain_blocked_by_account(@status.account)).where(domain: banned_domains_for_misskey)
expect_bot_query(scope).inboxes
@status.account.followers.or(@status.thread.account.followers.not_domain_blocked_by_account(@status.account)).where(domain: banned_domains_for_misskey).inboxes
elsif @status.direct_visibility? || @status.limited_visibility?
[]
else
scope = @status.account.followers.where(domain: banned_domains_for_misskey)
expect_bot_query(scope).inboxes
@status.account.followers.where(domain: banned_domains_for_misskey).inboxes
end
end
@ -167,12 +163,4 @@ class StatusReachFinder
from_domain_block = DomainBlock.where(detect_invalid_subscription: true).pluck(:domain)
(from_info + from_domain_block).uniq
end
def expect_bot_query(scope)
if @status.account.user&.setting_stop_deliver_to_bot
scope.where('actor_type NOT IN (\'Application\', \'Service\') OR accounts.id IN (?)', (@status.mentioned_accounts.pluck(:id) + [@status.in_reply_to_account_id]).compact)
else
scope
end
end
end