diff --git a/app/lib/activitypub/activity/create.rb b/app/lib/activitypub/activity/create.rb index 5eaf412120..9d1fea6cfe 100644 --- a/app/lib/activitypub/activity/create.rb +++ b/app/lib/activitypub/activity/create.rb @@ -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 diff --git a/app/models/form/admin_settings.rb b/app/models/form/admin_settings.rb index cbdd37654c..9d5e607674 100644 --- a/app/models/form/admin_settings.rb +++ b/app/models/form/admin_settings.rb @@ -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 diff --git a/app/models/public_feed.rb b/app/models/public_feed.rb index 648df08cc6..c40a96e2e3 100644 --- a/app/models/public_feed.rb +++ b/app/models/public_feed.rb @@ -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 diff --git a/app/models/tag_feed.rb b/app/models/tag_feed.rb index 4d2dd9f9b5..f9c8fb75ea 100644 --- a/app/models/tag_feed.rb +++ b/app/models/tag_feed.rb @@ -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? diff --git a/app/views/admin/ng_words/settings/show.html.haml b/app/views/admin/ng_words/settings/show.html.haml index 53d2ad3214..a8bf54922f 100644 --- a/app/views/admin/ng_words/settings/show.html.haml +++ b/app/views/admin/ng_words/settings/show.html.haml @@ -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 diff --git a/config/locales/en.yml b/config/locales/en.yml index 5494602520..46d0e49aff 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -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 diff --git a/config/locales/ja.yml b/config/locales/ja.yml index a3f19d013f..3c581b54d5 100644 --- a/config/locales/ja.yml +++ b/config/locales/ja.yml @@ -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: ホワイトリスト diff --git a/config/settings.yml b/config/settings.yml index eb8a733195..3b8a477a26 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -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: [] diff --git a/spec/lib/activitypub/activity/create_spec.rb b/spec/lib/activitypub/activity/create_spec.rb index 33eb48a363..a84eb887a1 100644 --- a/spec/lib/activitypub/activity/create_spec.rb +++ b/spec/lib/activitypub/activity/create_spec.rb @@ -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