Change: #556 ドメインブロック「フォローされていない相手からのリプライを拒否」に、参照を含める (#625)

This commit is contained in:
KMY(雪あすか) 2024-03-01 12:00:52 +09:00 committed by GitHub
parent 5646b4e1e6
commit bc07ebef3d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 54 additions and 10 deletions

View file

@ -325,6 +325,31 @@ RSpec.describe ActivityPub::ProcessStatusUpdateService, type: :service do
end
end
context 'when reject mentions to stranger by domain-block' do
let(:json_tags) do
[
{ type: 'Mention', href: ActivityPub::TagManager.instance.uri_for(alice) },
]
end
before do
Fabricate(:domain_block, domain: 'example.com', reject_reply_exclude_followers: true, severity: :noop)
end
it 'updates mentions' do
subject.call(status, json, json)
expect(status.mentions.reload.map(&:account_id)).to eq []
end
it 'updates mentions when follower' do
alice.follow!(status.account)
subject.call(status, json, json)
expect(status.mentions.reload.map(&:account_id)).to eq [alice.id]
end
end
context 'when originally without mentions' do
before do
subject.call(status, json, json)
@ -508,7 +533,7 @@ RSpec.describe ActivityPub::ProcessStatusUpdateService, type: :service do
end
end
context 'when hit ng words for mention' do
context 'when hit ng words for mention to local stranger' do
let(:json_tags) do
[
{ type: 'Mention', href: ActivityPub::TagManager.instance.uri_for(alice) },
@ -523,6 +548,15 @@ RSpec.describe ActivityPub::ProcessStatusUpdateService, type: :service do
expect(status.reload.text).to_not eq content
expect(status.mentioned_accounts.pluck(:id)).to_not include alice.id
end
it 'update status when following' do
Form::AdminSettings.new(ng_words_for_stranger_mention: 'test', stranger_mention_from_local_ng: '1').save
alice.follow!(status.account)
subject.call(status, json, json)
expect(status.reload.text).to eq content
expect(status.mentioned_accounts.pluck(:id)).to include alice.id
end
end
context 'when hit ng words for mention but local posts are not checked' do