Change: ホワイトリスト全体を有効にするオプション (#593)

This commit is contained in:
KMY(雪あすか) 2024-02-18 11:16:42 +09:00 committed by GitHub
parent dfc9f35d71
commit 1efeedf896
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 20 additions and 0 deletions

View file

@ -12,6 +12,7 @@ RSpec.describe ActivityPub::ProcessAccountService, type: :service do
describe 'about blocking new remote account' do
subject { described_class.new.call('alice', 'example.com', payload) }
let(:hold_remote_new_accounts) { true }
let(:permit_new_account_domains) { nil }
let(:payload) do
{
@ -24,6 +25,7 @@ RSpec.describe ActivityPub::ProcessAccountService, type: :service do
end
before do
Setting.hold_remote_new_accounts = hold_remote_new_accounts
Setting.permit_new_account_domains = permit_new_account_domains
end
@ -43,6 +45,16 @@ RSpec.describe ActivityPub::ProcessAccountService, type: :service do
expect(subject.remote_pending).to be true
end
context 'when the domain is not on list but hold_remote_new_accounts is disabled' do
let(:hold_remote_new_accounts) { false }
it 'creates normal account' do
expect(subject).to_not be_nil
expect(subject.suspended?).to be false
expect(subject.remote_pending).to be false
end
end
context 'with has existing account' do
before do
Fabricate(:account, uri: 'https://foo.test', domain: 'example.com', username: 'alice', note: 'old bio')