diff --git a/app/models/concerns/has_user_settings.rb b/app/models/concerns/has_user_settings.rb index 95c1f7a79a..ffb1bb0cac 100644 --- a/app/models/concerns/has_user_settings.rb +++ b/app/models/concerns/has_user_settings.rb @@ -79,6 +79,18 @@ module HasUserSettings settings['noai'] end + def setting_hide_statuses_count + settings['hide_statuses_count'] + end + + def setting_hide_following_count + settings['hide_following_count'] + end + + def setting_hide_followers_count + settings['hide_followers_count'] + end + def setting_theme settings['theme'] end diff --git a/app/models/user_settings.rb b/app/models/user_settings.rb index eca07e2f27..4eab568c27 100644 --- a/app/models/user_settings.rb +++ b/app/models/user_settings.rb @@ -12,6 +12,9 @@ class UserSettings setting :theme, default: -> { ::Setting.theme } setting :noindex, default: -> { ::Setting.noindex } setting :noai, default: true + setting :hide_statuses_count, default: false + setting :hide_following_count, default: false + setting :hide_followers_count, default: false setting :show_application, default: true setting :default_language, default: nil setting :default_sensitive, default: false diff --git a/app/serializers/activitypub/actor_serializer.rb b/app/serializers/activitypub/actor_serializer.rb index 2ec880920f..4d956b7944 100644 --- a/app/serializers/activitypub/actor_serializer.rb +++ b/app/serializers/activitypub/actor_serializer.rb @@ -172,8 +172,7 @@ class ActivityPub::ActorSerializer < ActivityPub::Serializer end def other_setting - config = { 'noindex' => object.noindex?, 'noai' => object.noai?, 'hide_network' => object.hide_collections } - config = config.merge(object.settings) if object.settings.present? + config = object.public_settings config.map do |k, v| { type: 'PropertyValue', diff --git a/app/serializers/rest/account_serializer.rb b/app/serializers/rest/account_serializer.rb index 90ff61cde7..48d13049d0 100644 --- a/app/serializers/rest/account_serializer.rb +++ b/app/serializers/rest/account_serializer.rb @@ -157,18 +157,18 @@ class REST::AccountSerializer < ActiveModel::Serializer end def statuses_count - object.settings.present? && object.settings['hide_statuses_count'] ? 0 : object.statuses_count + object.hide_statuses_count? ? 0 : object.statuses_count end def followers_count - object.settings.present? && object.settings['hide_followers_count'] ? 0 : object.followers_count + object.hide_followers_count? ? 0 : object.followers_count end def following_count - object.settings.present? && object.settings['hide_followers_count'] ? 0 : object.following_count + object.hide_following_count? ? 0 : object.following_count end def other_settings - object.suspended? || object.settings.nil? ? {} : object.settings + object.suspended? ? {} : object.public_settings end end diff --git a/app/views/settings/preferences/other/show.html.haml b/app/views/settings/preferences/other/show.html.haml index 69ca38e94a..7b1ef2d0c2 100644 --- a/app/views/settings/preferences/other/show.html.haml +++ b/app/views/settings/preferences/other/show.html.haml @@ -49,6 +49,18 @@ .fields-group = f.input :setting_reject_unlisted_subscription, kmyblue: true, as: :boolean, wrapper: :with_label + %h4= t 'preferences.hide' + + = f.simple_fields_for :settings, current_user.settings do |ff| + .fields-group + = ff.input :hide_statuses_count, as: :boolean, wrapper: :with_label, kmyblue: true, label: I18n.t('simple_form.labels.defaults.setting_hide_statuses_count'), hint: false + + .fields-group + = ff.input :hide_following_count, as: :boolean, wrapper: :with_label, kmyblue: true, label: I18n.t('simple_form.labels.defaults.setting_hide_following_count'), hint: false + + .fields-group + = ff.input :hide_followers_count, as: :boolean, wrapper: :with_label, kmyblue: true, label: I18n.t('simple_form.labels.defaults.setting_hide_followers_count'), hint: false + %h4= t 'preferences.public_timelines' .fields-group diff --git a/config/locales/ja.yml b/config/locales/ja.yml index 63c0d40aa5..b08d58e1e1 100644 --- a/config/locales/ja.yml +++ b/config/locales/ja.yml @@ -1492,6 +1492,7 @@ ja: too_few_options: は複数必要です too_many_options: は%{max}個までです preferences: + hide: 隠蔽 other: その他 posting_defaults: デフォルトの投稿設定 public_timelines: 公開タイムライン diff --git a/config/locales/simple_form.en.yml b/config/locales/simple_form.en.yml index db447b0eb1..2de346faf2 100644 --- a/config/locales/simple_form.en.yml +++ b/config/locales/simple_form.en.yml @@ -220,7 +220,10 @@ en: setting_display_media_show_all: Show all setting_emoji_reaction_streaming_notify_impl2: Enable stamp notification compat with Nyastodon, Catstodon, glitch-soc setting_expand_spoilers: Always expand posts marked with content warnings + setting_hide_followers_count: Hide followers count + setting_hide_following_count: Hide following count setting_hide_network: Hide your social graph + setting_hide_statuses_count: Hide statuses count setting_noai: Set noai meta tags setting_noindex: Opt-out of search engine indexing setting_public_post_to_unlisted: Convert public post to public unlisted if not using Web app diff --git a/config/locales/simple_form.ja.yml b/config/locales/simple_form.ja.yml index a3d848f288..f0418cf61c 100644 --- a/config/locales/simple_form.ja.yml +++ b/config/locales/simple_form.ja.yml @@ -227,7 +227,10 @@ ja: setting_display_media_show_all: 表示 setting_emoji_reaction_streaming_notify_impl2: Nyastodon, Catstodon, glitch-soc互換のスタンプ機能を有効にする setting_expand_spoilers: 閲覧注意としてマークされた投稿を常に展開する + setting_hide_followers_count: フォロワー数を隠す + setting_hide_following_count: フォロー数を隠す setting_hide_network: 繋がりを隠す + setting_hide_statuses_count: 投稿数を隠す setting_noai: 自分のコンテンツのAI学習利用に対して不快感を表明する setting_noindex: 検索エンジンによるインデックスを拒否する setting_public_post_to_unlisted: サードパーティアプリから投稿するとき、公開投稿をローカル公開に変更する