Add: ローカルからフォローされていない全てのアカウントからのフォローを拒否する設定 (#592)
* Add: ローカルからフォローされていない全てのアカウントからのフォローを拒否する設定 * Fix test * Fix test
This commit is contained in:
parent
1efeedf896
commit
c35c13ffba
8 changed files with 58 additions and 2 deletions
|
@ -20,7 +20,7 @@ import { IconButton } from '../../../components/icon_button';
|
|||
const messages = defineMessages({
|
||||
remove: { id: 'lists.account.remove', defaultMessage: 'Remove from list' },
|
||||
add: { id: 'lists.account.add', defaultMessage: 'Add to list' },
|
||||
exclusive: { id: 'lists.exclusive', defaultMessage: 'Exclusive from home' },
|
||||
exclusive: { id: 'lists.exclusive', defaultMessage: 'Hide list or antenna account posts from home' },
|
||||
});
|
||||
|
||||
const MapStateToProps = (state, { listId, added }) => ({
|
||||
|
|
|
@ -221,7 +221,7 @@ class ListTimeline extends PureComponent {
|
|||
<div className='setting-toggle'>
|
||||
<Toggle id={`list-${id}-exclusive`} checked={isExclusive} onChange={this.onExclusiveToggle} />
|
||||
<label htmlFor={`list-${id}-exclusive`} className='setting-toggle__label'>
|
||||
<FormattedMessage id='lists.exclusive' defaultMessage='Hide these posts from home or STL' />
|
||||
<FormattedMessage id='lists.exclusive' defaultMessage='Hide list or antenna account posts from home' />
|
||||
</label>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -149,6 +149,7 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
|
|||
valid = !Admin::NgWord.mention_reject?(@raw_mention_uris.size, uri: @params[:uri], target_type: :status, public: @status_parser.distributable_visibility?, text: "#{@params[:spoiler_text]}\n#{@params[:text]}") if valid
|
||||
valid = !Admin::NgWord.stranger_mention_reject_with_count?(@raw_mention_uris.size, uri: @params[:uri], target_type: :status, public: @status_parser.distributable_visibility?, text: "#{@params[:spoiler_text]}\n#{@params[:text]}") if valid && (mention_to_local_stranger? || reference_to_local_stranger?)
|
||||
valid = !Admin::NgWord.stranger_mention_reject?("#{@params[:spoiler_text]}\n#{@params[:text]}", uri: @params[:uri], target_type: :status, public: @status_parser.distributable_visibility?) if valid && (mention_to_local_stranger? || reference_to_local_stranger?)
|
||||
valid = false if valid && Setting.block_unfollow_account_mention && (mention_to_local_stranger? || reference_to_local_stranger?) && !local_following_sender?
|
||||
|
||||
valid
|
||||
end
|
||||
|
@ -486,6 +487,10 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
|
|||
@reject_reply_exclude_followers ||= DomainBlock.reject_reply_exclude_followers?(@account.domain)
|
||||
end
|
||||
|
||||
def local_following_sender?
|
||||
::Follow.exists?(account: Account.local, target_account: @account)
|
||||
end
|
||||
|
||||
def ignore_hashtags?
|
||||
return @ignore_hashtags if defined?(@ignore_hashtags)
|
||||
|
||||
|
|
|
@ -65,6 +65,7 @@ class Form::AdminSettings
|
|||
enable_local_timeline
|
||||
emoji_reaction_disallow_domains
|
||||
permit_new_account_domains
|
||||
block_unfollow_account_mention
|
||||
hold_remote_new_accounts
|
||||
).freeze
|
||||
|
||||
|
@ -108,6 +109,7 @@ class Form::AdminSettings
|
|||
stranger_mention_from_local_ng
|
||||
enable_local_timeline
|
||||
delete_content_cache_without_reaction
|
||||
block_unfollow_account_mention
|
||||
hold_remote_new_accounts
|
||||
).freeze
|
||||
|
||||
|
|
|
@ -32,6 +32,9 @@
|
|||
.fields-group
|
||||
= f.input :hide_local_users_for_anonymous, wrapper: :with_label, as: :boolean, label: t('admin.ng_words.hide_local_users_for_anonymous')
|
||||
|
||||
.fields-group
|
||||
= f.input :block_unfollow_account_mention, wrapper: :with_label, as: :boolean, label: t('admin.ng_words.block_unfollow_account_mention')
|
||||
|
||||
%p.hint
|
||||
= t 'admin.ng_words.remote_approval_hint'
|
||||
= link_to t('admin.ng_words.remote_approval_list'), admin_accounts_path(status: 'remote_pending', origin: 'remote')
|
||||
|
|
|
@ -648,6 +648,7 @@ en:
|
|||
media_attachments:
|
||||
title: Media attachments
|
||||
ng_words:
|
||||
block_unfollow_account_mention: Reject all mentions/references from all accounts that do not have followers on your server
|
||||
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
|
||||
|
|
|
@ -641,6 +641,7 @@ ja:
|
|||
media_attachments:
|
||||
title: 投稿された画像
|
||||
ng_words:
|
||||
block_unfollow_account_mention: 自分のサーバーのフォロワーを持たない全てのアカウントからのメンション・参照を全て拒否する
|
||||
hide_local_users_for_anonymous: ログインしていない状態でローカルユーザーの投稿をタイムラインから取得できないようにする
|
||||
history_hint: 設定されたNGワードによって実際に拒否された投稿などは、履歴より確認できます。NGワードの指定に誤りがないか定期的に確認することをおすすめします。
|
||||
hold_remote_new_accounts: リモートの新規アカウントを保留する
|
||||
|
|
|
@ -2219,6 +2219,50 @@ RSpec.describe ActivityPub::Activity::Create do
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'when stranger mention for domain' do
|
||||
let(:object_json) do
|
||||
{
|
||||
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
|
||||
type: 'Note',
|
||||
content: 'Lorem ipsum',
|
||||
to: 'https://www.w3.org/ns/activitystreams#Public',
|
||||
tag: [
|
||||
{
|
||||
type: 'Mention',
|
||||
href: ActivityPub::TagManager.instance.uri_for(Fabricate(:account)),
|
||||
},
|
||||
],
|
||||
}
|
||||
end
|
||||
|
||||
context 'when the domain does not have follower' do
|
||||
let(:custom_before) { true }
|
||||
|
||||
before do
|
||||
Setting.block_unfollow_account_mention = true
|
||||
subject.perform
|
||||
end
|
||||
|
||||
it 'creates status' do
|
||||
expect(sender.statuses.first).to be_nil
|
||||
end
|
||||
end
|
||||
|
||||
context 'when other account following' do
|
||||
let(:custom_before) { true }
|
||||
|
||||
before do
|
||||
Setting.block_unfollow_account_mention = true
|
||||
Fabricate(:account).follow!(sender)
|
||||
subject.perform
|
||||
end
|
||||
|
||||
it 'creates status' do
|
||||
expect(sender.statuses.first).to_not be_nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'when object URI uses bearcaps' do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue