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?