* Add: #586 保留中のリモートアカウントからのフォローが飛んできた場合に記録する * 本家に戻す処理を修正 * Fix test * Fix worker link * Fix test * リモートアカウント拒否時に既存のリクエストを削除
This commit is contained in:
parent
1b3c0e3fb7
commit
dfc9f35d71
15 changed files with 262 additions and 31 deletions
35
app/helpers/follow_helper.rb
Normal file
35
app/helpers/follow_helper.rb
Normal file
|
@ -0,0 +1,35 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module FollowHelper
|
||||
def request_pending_follow?(source_account, target_account)
|
||||
target_account.locked? || source_account.silenced? || block_straight_follow?(source_account) ||
|
||||
((source_account.bot? || proxy_account?(source_account)) && target_account.user&.setting_lock_follow_from_bot)
|
||||
end
|
||||
|
||||
def block_straight_follow?(account)
|
||||
return false if account.local?
|
||||
|
||||
DomainBlock.reject_straight_follow?(account.domain)
|
||||
end
|
||||
|
||||
def proxy_account?(account)
|
||||
(account.username.downcase.include?('_proxy') ||
|
||||
account.username.downcase.end_with?('proxy') ||
|
||||
account.username.downcase.include?('_bot_') ||
|
||||
account.username.downcase.end_with?('bot') ||
|
||||
account.display_name&.downcase&.include?('proxy') ||
|
||||
account.display_name&.include?('プロキシ') ||
|
||||
account.note&.include?('プロキシ')) &&
|
||||
(account.following_count.zero? || account.following_count > account.followers_count) &&
|
||||
proxyable_software?(account)
|
||||
end
|
||||
|
||||
def proxyable_software?(account)
|
||||
return false if account.local?
|
||||
|
||||
info = InstanceInfo.find_by(domain: account.domain)
|
||||
return false if info.nil?
|
||||
|
||||
%w(misskey calckey firefish meisskey cherrypick sharkey).include?(info.software)
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue