プロキシ判定ロジックを調整

This commit is contained in:
KMY 2023-10-07 13:17:47 +09:00
parent 41c1aaf54d
commit d94713594c
2 changed files with 8 additions and 7 deletions

View file

@ -52,11 +52,12 @@ class ActivityPub::Activity::Follow < ActivityPub::Activity
end
def proxy_account?
(@account.username.downcase.include?('proxy') ||
@account.username.downcase.include?('followbot') ||
(@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&.downcase&.include?('proxy') ||
@account.note&.include?('プロキシ')) && proxyable_software?
end

View file

@ -4,8 +4,8 @@ require 'rails_helper'
RSpec.describe ActivityPub::Activity::Follow do
let(:actor_type) { 'Person' }
let(:note) { '' }
let(:sender) { Fabricate(:account, domain: 'example.com', inbox_url: 'https://example.com/inbox', actor_type: actor_type, note: note) }
let(:display_name) { '' }
let(:sender) { Fabricate(:account, domain: 'example.com', inbox_url: 'https://example.com/inbox', actor_type: actor_type, display_name: display_name) }
let(:recipient) { Fabricate(:account) }
let(:json) do
@ -105,7 +105,7 @@ RSpec.describe ActivityPub::Activity::Follow do
end
context 'when unlocked misskey proxy account but locked from bot' do
let(:note) { 'i am proxy.' }
let(:display_name) { 'i am proxy.' }
before do
Fabricate(:instance_info, domain: 'example.com', software: 'misskey')
@ -125,7 +125,7 @@ RSpec.describe ActivityPub::Activity::Follow do
end
context 'when unlocked mastodon proxy account but locked from bot' do
let(:note) { 'i am proxy.' }
let(:display_name) { 'i am proxy.' }
before do
Fabricate(:instance_info, domain: 'example.com', software: 'mastodon')