Add: #30 ローカルユーザーからのスタンプに関するポリシー設定 (#354)

This commit is contained in:
KMY(雪あすか) 2023-12-12 09:44:10 +09:00 committed by GitHub
parent 3e8b4752a1
commit 903b9ad347
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 31 additions and 2 deletions

View file

@ -256,7 +256,8 @@ RSpec.describe Account do
describe '#allow_emoji_reaction?' do
let(:policy) { :allow }
let(:reactioned) { Fabricate(:user, settings: { emoji_reaction_policy: policy }).account }
let(:allow_local) { false }
let(:reactioned) { Fabricate(:user, settings: { emoji_reaction_policy: policy, slip_local_emoji_reaction: allow_local }).account }
let(:followee) { Fabricate(:account) }
let(:follower) { Fabricate(:account) }
let(:mutual) { Fabricate(:account) }
@ -411,6 +412,21 @@ RSpec.describe Account do
end
end
context 'when policy is block but allow local only' do
let(:policy) { :block }
let(:allow_local) { true }
let(:local) { Fabricate(:user).account }
let(:remote) { Fabricate(:account, domain: 'example.com', uri: 'https://example.com/actor') }
it 'does not allow remote' do
expect(reactioned.allow_emoji_reaction?(remote)).to be false
end
it 'allows local' do
expect(reactioned.allow_emoji_reaction?(local)).to be true
end
end
context 'when reactioned is remote user' do
let(:reactioned) { Fabricate(:account, domain: 'foo.bar', uri: 'https://foo.bar/actor', settings: { emoji_reaction_policy: :following_only }) }