Change: ホワイトリスト全体を有効にするオプション (#593)
This commit is contained in:
parent
dfc9f35d71
commit
1efeedf896
6 changed files with 20 additions and 0 deletions
|
@ -65,6 +65,7 @@ class Form::AdminSettings
|
|||
enable_local_timeline
|
||||
emoji_reaction_disallow_domains
|
||||
permit_new_account_domains
|
||||
hold_remote_new_accounts
|
||||
).freeze
|
||||
|
||||
INTEGER_KEYS = %i(
|
||||
|
@ -107,6 +108,7 @@ class Form::AdminSettings
|
|||
stranger_mention_from_local_ng
|
||||
enable_local_timeline
|
||||
delete_content_cache_without_reaction
|
||||
hold_remote_new_accounts
|
||||
).freeze
|
||||
|
||||
UPLOAD_KEYS = %i(
|
||||
|
|
|
@ -140,6 +140,7 @@ class ActivityPub::ProcessAccountService < BaseService
|
|||
end
|
||||
|
||||
def blocking_new_account?
|
||||
return false unless Setting.hold_remote_new_accounts
|
||||
return false if permit_new_account_domains.blank?
|
||||
|
||||
permit_new_account_domains.exclude?(@domain)
|
||||
|
|
|
@ -36,6 +36,9 @@
|
|||
= t 'admin.ng_words.remote_approval_hint'
|
||||
= link_to t('admin.ng_words.remote_approval_list'), admin_accounts_path(status: 'remote_pending', origin: 'remote')
|
||||
|
||||
.fields-group
|
||||
= f.input :hold_remote_new_accounts, wrapper: :with_label, as: :boolean, label: t('admin.ng_words.hold_remote_new_accounts')
|
||||
|
||||
.fields-group
|
||||
= f.input :permit_new_account_domains, wrapper: :with_label, as: :text, kmyblue: true, input_html: { rows: 6 }, label: t('admin.ng_words.permit_new_account_domains')
|
||||
|
||||
|
|
|
@ -650,6 +650,7 @@ en:
|
|||
ng_words:
|
||||
hide_local_users_for_anonymous: Hide timeline local user posts from anonymous
|
||||
history_hint: We recommend that you regularly check your NG words to make sure that you have not specified the NG words incorrectly.
|
||||
hold_remote_new_accounts: Hold new remote accounts
|
||||
keywords: Reject keywords
|
||||
keywords_for_stranger_mention: Reject keywords when mention/reply/reference/quote from strangers
|
||||
keywords_for_stranger_mention_hint: This words are checked posts from other servers only.
|
||||
|
|
|
@ -643,6 +643,7 @@ ja:
|
|||
ng_words:
|
||||
hide_local_users_for_anonymous: ログインしていない状態でローカルユーザーの投稿をタイムラインから取得できないようにする
|
||||
history_hint: 設定されたNGワードによって実際に拒否された投稿などは、履歴より確認できます。NGワードの指定に誤りがないか定期的に確認することをおすすめします。
|
||||
hold_remote_new_accounts: リモートの新規アカウントを保留する
|
||||
keywords: 投稿できないキーワード
|
||||
keywords_for_stranger_mention: フォローしていないアカウントへのメンションや参照で利用できないキーワード
|
||||
keywords_for_stranger_mention_hint: フォローしていないアカウントへのメンション、参照、引用にのみ適用されます
|
||||
|
|
|
@ -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')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue