Add hide_local_users_for_anonymous setting

This commit is contained in:
KMY 2023-07-24 12:12:37 +09:00
parent bf0d6fd2f5
commit 650cfae270
6 changed files with 13 additions and 2 deletions

View file

@ -36,6 +36,7 @@ class Form::AdminSettings
captcha_enabled
ng_words
enable_block_emoji_reaction_settings
hide_local_users_for_anonymous
).freeze
INTEGER_KEYS = %i(
@ -57,6 +58,7 @@ class Form::AdminSettings
require_invite_text
captcha_enabled
enable_block_emoji_reaction_settings
hide_local_users_for_anonymous
).freeze
UPLOAD_KEYS = %i(

View file

@ -24,7 +24,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?
scope.merge!(remote_only_scope) if remote_only? || hide_local_users?
scope.merge!(global_timeline_only_scope) if global_timeline?
scope.merge!(account_filters_scope) if account?
scope.merge!(media_only_scope) if media_only?
@ -54,6 +54,10 @@ class PublicFeed
options[:remote]
end
def hide_local_users?
@account.nil? && Setting.hide_local_users_for_anonymous
end
def global_timeline?
!options[:remote] && !options[:local]
end

View file

@ -29,7 +29,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?
scope.merge!(remote_only_scope) if remote_only? || hide_local_users?
scope.merge!(account_filters_scope) if account?
scope.merge!(media_only_scope) if media_only?
scope.merge!(anonymous_scope) unless account?

View file

@ -13,5 +13,8 @@
.fields-group
= f.input :enable_block_emoji_reaction_settings, wrapper: :with_label, as: :boolean, label: t('admin.ng_words.enable_block_emoji_reaction_settings')
.fields-group
= f.input :hide_local_users_for_anonymous, wrapper: :with_label, as: :boolean, label: t('admin.ng_words.hide_local_users_for_anonymous')
.actions
= f.button :button, t('generic.save_changes'), type: :submit

View file

@ -597,6 +597,7 @@ en:
title: Media attachments
ng_words:
enable_block_emoji_reaction_settings: Enable block emoji reactions settings for users
hide_local_users_for_anonymous: Hide timeline local user posts from anonymous
keywords: Reject keywords
title: NG words and against spams
relationships:

View file

@ -596,6 +596,7 @@ ja:
title: 投稿された画像
ng_words:
enable_block_emoji_reaction_settings: 各ユーザーにスタンプ機能のブロック設定項目を解放する
hide_local_users_for_anonymous: ログインしていない状態でローカルユーザーの投稿をタイムラインから取得できないようにする
keywords: 投稿できないキーワード
title: NGワードとスパム
relationships: