Fix: #959 NGルールで絵文字リアクションを拒否した場合、自分のサーバーのカスタム絵文字は常に拒否される (#963)

* Fix: #959 NGルールで絵文字リアクションを拒否した場合、自分のサーバーのカスタム絵文字は常に拒否される

* Fix test

* Fix test
This commit is contained in:
KMY(雪あすか) 2025-01-28 12:22:20 +09:00 committed by KMY
parent 3eead356e7
commit d7deb6f640
2 changed files with 35 additions and 3 deletions

View file

@ -278,5 +278,35 @@ RSpec.describe Admin::NgRule do
it_behaves_like 'matches rule', 'reaction'
end
context 'with emoji reaction origin domain' do
let(:account) { Fabricate(:account, domain: 'example.com', uri: 'https://example.com/actor') }
let(:ng_rule) { Fabricate(:ng_rule, reaction_type: ['emoji_reaction'], emoji_reaction_origin_domain: 'ohagi.com') }
context 'when remote emoji matches domain' do
let(:options) { { uri: uri, recipient: Fabricate(:account), reaction_type: 'emoji_reaction', emoji_reaction_origin_domain: 'ohagi.com' } }
it_behaves_like 'matches rule', 'reaction'
end
context 'when remote emoji does not match domain' do
let(:options) { { uri: uri, recipient: Fabricate(:account), reaction_type: 'emoji_reaction', emoji_reaction_origin_domain: 'test.com' } }
it_behaves_like 'does not match rule'
end
context 'when local emoji' do
let(:options) { { uri: uri, recipient: Fabricate(:account), reaction_type: 'emoji_reaction', emoji_reaction_origin_domain: nil } }
it_behaves_like 'does not match rule'
end
context 'when local emoji but all options match' do
let(:ng_rule) { Fabricate(:ng_rule, reaction_type: ['emoji_reaction']) }
let(:options) { { uri: uri, recipient: Fabricate(:account), reaction_type: 'emoji_reaction', emoji_reaction_origin_domain: nil } }
it_behaves_like 'matches rule', 'reaction'
end
end
end
end