Skip to content

Commit

Permalink
Remove: #609 NGワード設定の2項目を削除
Browse files Browse the repository at this point in the history
  • Loading branch information
kmycode committed Aug 5, 2024
1 parent 9e1c63a commit 8b503eb
Show file tree
Hide file tree
Showing 8 changed files with 4 additions and 78 deletions.
1 change: 0 additions & 1 deletion app/lib/activitypub/activity/create.rb
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ def valid_status?
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
Expand Down
4 changes: 0 additions & 4 deletions app/models/form/admin_settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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

Expand Down
6 changes: 1 addition & 5 deletions app/models/public_feed.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def get(limit, max_id = nil, since_id = nil, min_id = nil)
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?
Expand Down Expand Up @@ -56,10 +56,6 @@ def remote_only?
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
Expand Down
9 changes: 0 additions & 9 deletions app/views/admin/ng_words/settings/show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 1 addition & 7 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
8 changes: 1 addition & 7 deletions config/locales/ja.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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: ホワイトリスト
Expand Down
2 changes: 1 addition & 1 deletion config/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: []

Expand Down
44 changes: 0 additions & 44 deletions spec/lib/activitypub/activity/create_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2273,50 +2273,6 @@ def activity_for_object(json)
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
Expand Down

0 comments on commit 8b503eb

Please sign in to comment.