Remove: #609 NGワード設定の2項目を削除 (#789)

* Remove: #609 NGワード設定の2項目を削除

* Fix test
This commit is contained in:
KMY(雪あすか) 2024-08-06 09:17:36 +09:00 committed by GitHub
parent dd7a2a6bbf
commit b787b130a2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 5 additions and 79 deletions

View file

@ -166,7 +166,6 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
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]}")
end
valid = false if valid && Setting.block_unfollow_account_mention && (mention_to_local_stranger? || reference_to_local_stranger?) && !local_following_sender?
valid
end

View file

@ -45,7 +45,6 @@ class Form::AdminSettings
status_page_url
captcha_enabled
stranger_mention_from_local_ng
hide_local_users_for_anonymous
post_hash_tags_max
post_mentions_max
post_stranger_mentions_max
@ -61,7 +60,6 @@ class Form::AdminSettings
unlocked_friend
enable_local_timeline
emoji_reaction_disallow_domains
block_unfollow_account_mention
hold_remote_new_accounts
stop_fetch_activity_domains
stop_link_preview_domains
@ -96,7 +94,6 @@ class Form::AdminSettings
noindex
require_invite_text
captcha_enabled
hide_local_users_for_anonymous
authorized_fetch
receive_other_servers_emoji_reaction
streaming_other_servers_emoji_reaction
@ -109,7 +106,6 @@ 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

View file

@ -26,7 +26,7 @@ class PublicFeed
scope.merge!(without_replies_scope) unless with_replies?
scope.merge!(without_reblogs_scope) unless with_reblogs?
scope.merge!(local_only_scope) if local_only?
scope.merge!(remote_only_scope) if remote_only? || hide_local_users?
scope.merge!(remote_only_scope) if remote_only?
scope.merge!(account_filters_scope) if account?
scope.merge!(media_only_scope) if media_only?
scope.merge!(language_scope) if account&.chosen_languages.present?
@ -56,10 +56,6 @@ class PublicFeed
options[:remote] && !options[:local] && Setting.enable_local_timeline
end
def hide_local_users?
@account.nil? && Setting.hide_local_users_for_anonymous
end
def account?
account.present?
end

View file

@ -31,7 +31,7 @@ class TagFeed < PublicFeed
scope.merge!(tagged_with_all_scope)
scope.merge!(tagged_with_none_scope)
scope.merge!(local_only_scope) if local_only?
scope.merge!(remote_only_scope) if remote_only? || hide_local_users?
scope.merge!(remote_only_scope) if remote_only?
scope.merge!(account_filters_scope) if account?
scope.merge!(media_only_scope) if media_only?
# scope.merge!(anonymous_scope) unless account?

View file

@ -20,17 +20,8 @@
.fields-group
= f.input :post_mentions_max, wrapper: :with_label, as: :integer, label: t('admin.ng_words.post_mentions_max')
%h4= t('admin.ng_words.deprecated')
%p.hint= t('admin.ng_words.deprecated_hint')
.fields-group
= f.input :stranger_mention_from_local_ng, wrapper: :with_label, as: :boolean, label: t('admin.ng_words.stranger_mention_from_local_ng'), hint: t('admin.ng_words.stranger_mention_from_local_ng_hint')
.fields-group
= f.input :hide_local_users_for_anonymous, wrapper: :with_label, as: :boolean, label: t('admin.ng_words.hide_local_users_for_anonymous'), hint: t('admin.ng_words.hide_local_users_for_anonymous_hint')
.fields-group
= f.input :block_unfollow_account_mention, wrapper: :with_label, as: :boolean, label: t('admin.ng_words.block_unfollow_account_mention'), hint: t('admin.ng_words.block_unfollow_account_mention_hint')
.actions
= f.button :button, t('generic.save_changes'), type: :submit

View file

@ -755,14 +755,8 @@ en:
test_error: Regular expression syntax is incorrect.
title: NG Rule
ng_words:
block_unfollow_account_mention: Reject all mentions/quotes from all accounts that do not have followers on your server
block_unfollow_account_mention_hint: This setting will be removed. After the setting is removed, the behavior will always be the same as if it were unchecked; please use NG rules instead.
deprecated: Will remove settings
deprecated_hint: These settings will be removed in the next LTS or kmyblue version 14.0, whichever comes first. Please refer to the description of each setting and replace them with the new settings if possible.
edit:
add_domain: Add domain
hide_local_users_for_anonymous: Hide timeline local user posts from anonymous
hide_local_users_for_anonymous_hint: This setting will be removed. After the setting is removed, the behavior will always be the same as if it were unchecked. It can be replaced, though not completely, by "Allow unauthorized access to public timelines" in the "Find" section of the server settings.
hold_remote_new_accounts: Hold new remote accounts
keywords: Reject keywords
keywords_for_stranger_mention: Keywords for stranger mention
@ -780,7 +774,7 @@ en:
save_error: Has save errors
settings: Settings
stranger_mention_from_local_ng: NG words for Mention to accounts you do not follow are also applied to posts by local users.
stranger_mention_from_local_ng_hint: This setting will be removed. After the setting is removed, the behavior will be the same as if it is always checked. If you do not wish this behavior, please use NG rules instead.
stranger_mention_from_local_ng_hint: Use this if there is a possibility that a spam account has entered your server
test_error: Testing is returned any errors
title: NG words and against spams
white_list: White list

View file

@ -741,14 +741,8 @@ ja:
test_error: 正規表現の文法が誤っています
title: NGルール
ng_words:
block_unfollow_account_mention: 自分のサーバーのフォロワーを持たない全てのアカウントからのメンション・引用を全て拒否する
block_unfollow_account_mention_hint: この設定は削除予定です。設定削除後は、常にチェックをつけていない場合と同じ挙動になります。NGルールで代替してください。
deprecated: 新しいバージョンで削除する予定の設定
deprecated_hint: これらの設定は、次回のLTS、またはkmyblueバージョン14.0のどちらか早い方で削除する予定です。それぞれの設定の説明を参照して、可能であれば新しい設定に置き換えてください。
edit:
add_domain: ドメインを追加
hide_local_users_for_anonymous: ログインしていない状態でローカルユーザーの投稿をタイムラインから取得できないようにする
hide_local_users_for_anonymous_hint: この設定は削除予定です。設定削除後は、常にチェックをつけていない場合と同じ挙動になります。サーバー設定の「見つける」にある「公開タイムラインへの未認証のアクセスを許可する」で、完全ではありませんが代替可能です。
hold_remote_new_accounts: リモートの新規アカウントを保留する
keywords: 拒否するキーワード
phrases:
@ -764,7 +758,7 @@ ja:
remote_approval_list: 承認待ちのリモートアカウント一覧
settings: 詳細設定
stranger_mention_from_local_ng: フォローしていないアカウントへのメンションのNGワードを、ローカルユーザーによる投稿にも適用する
stranger_mention_from_local_ng_hint: この設定は削除予定です。設定削除後は、常にチェックをつけている場合と同じ挙動になります。この動作を希望しない場合は、NGルールで代替してください
stranger_mention_from_local_ng_hint: 自分のサーバーにスパムアカウントが入り込んでいる可能性がある場合に利用します
test_error: NGワードのテストに失敗しました。正規表現のミスが含まれているかもしれません
title: NGワードとスパム
white_list: ホワイトリスト

View file

@ -53,7 +53,7 @@ defaults: &defaults
enable_public_visibility: true
enable_public_unlisted_visibility: true
unlocked_friend: false
stranger_mention_from_local_ng: true
stranger_mention_from_local_ng: false
enable_local_timeline: true
emoji_reaction_disallow_domains: []

View file

@ -2273,50 +2273,6 @@ 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