Add block from bot follow settings
This commit is contained in:
parent
214092b517
commit
ff994d78fa
12 changed files with 208 additions and 13 deletions
|
@ -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?
|
||||
if target_account.locked? || @account.silenced? || block_straight_follow? || (@account.bot? && target_account.user&.setting_lock_follow_from_bot)
|
||||
LocalNotificationWorker.perform_async(target_account.id, follow_request.id, 'FollowRequest', 'follow_request')
|
||||
else
|
||||
AuthorizeFollowService.new.call(@account, target_account)
|
||||
|
|
|
@ -30,9 +30,9 @@ class StatusReachFinder
|
|||
if @status.reblog?
|
||||
[]
|
||||
elsif @status.limited_visibility?
|
||||
Account.where(id: mentioned_account_ids).where.not(domain: banned_domains).inboxes
|
||||
expect_bot_query(Account.where(id: mentioned_account_ids).where.not(domain: banned_domains)).inboxes
|
||||
else
|
||||
Account.where(id: reached_account_ids).where.not(domain: banned_domains).inboxes
|
||||
expect_bot_query(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?
|
||||
Account.where(id: mentioned_account_ids).where(domain: banned_domains_for_misskey).inboxes
|
||||
expect_bot_query(Account.where(id: mentioned_account_ids).where(domain: banned_domains_for_misskey)).inboxes
|
||||
else
|
||||
Account.where(id: reached_account_ids).where(domain: banned_domains_for_misskey).inboxes
|
||||
expect_bot_query(Account.where(id: reached_account_ids).where(domain: banned_domains_for_misskey)).inboxes
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -90,21 +90,25 @@ class StatusReachFinder
|
|||
|
||||
def followers_inboxes
|
||||
if @status.in_reply_to_local_account? && distributable?
|
||||
@status.account.followers.or(@status.thread.account.followers.not_domain_blocked_by_account(@status.account)).where.not(domain: banned_domains).inboxes
|
||||
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
|
||||
elsif @status.direct_visibility? || @status.limited_visibility?
|
||||
[]
|
||||
else
|
||||
@status.account.followers.where.not(domain: banned_domains).inboxes
|
||||
scope = @status.account.followers.where.not(domain: banned_domains)
|
||||
expect_bot_query(scope).inboxes
|
||||
end
|
||||
end
|
||||
|
||||
def followers_inboxes_for_misskey
|
||||
if @status.in_reply_to_local_account? && distributable?
|
||||
@status.account.followers.or(@status.thread.account.followers.not_domain_blocked_by_account(@status.account)).where(domain: banned_domains_for_misskey).inboxes
|
||||
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
|
||||
elsif @status.direct_visibility? || @status.limited_visibility?
|
||||
[]
|
||||
else
|
||||
@status.account.followers.where(domain: banned_domains_for_misskey).inboxes
|
||||
scope = @status.account.followers.where(domain: banned_domains_for_misskey)
|
||||
expect_bot_query(scope).inboxes
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -163,4 +167,12 @@ 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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue