diff --git a/app/controllers/settings/profiles_controller.rb b/app/controllers/settings/profiles_controller.rb index 9f00b3dc48..3ff6046c19 100644 --- a/app/controllers/settings/profiles_controller.rb +++ b/app/controllers/settings/profiles_controller.rb @@ -20,7 +20,7 @@ class Settings::ProfilesController < Settings::BaseController private def account_params - params.require(:account).permit(:display_name, :note, :bio_markdown, :avatar, :header, :locked, :my_actor_type, :searchability, :dissubscribable, :group_allow_private_message, :discoverable, :hide_collections, fields_attributes: [:name, :value]) + params.require(:account).permit(:display_name, :note, :bio_markdown, :avatar, :header, :locked, :my_actor_type, :searchability, :dissubscribable, :group_allow_private_message, :discoverable, :discoverable_local, :hide_collections, fields_attributes: [:name, :value]) end def set_account diff --git a/app/models/concerns/has_user_settings.rb b/app/models/concerns/has_user_settings.rb index b78f67ce1e..475ab2c9d2 100644 --- a/app/models/concerns/has_user_settings.rb +++ b/app/models/concerns/has_user_settings.rb @@ -111,6 +111,10 @@ module HasUserSettings settings['bio_markdown'] end + def setting_discoverable_local + settings['discoverable_local'] + end + def setting_display_media settings['web.display_media'] end diff --git a/app/models/user_settings.rb b/app/models/user_settings.rb index 997600489f..7162d847b1 100644 --- a/app/models/user_settings.rb +++ b/app/models/user_settings.rb @@ -13,6 +13,7 @@ class UserSettings setting :noindex, default: -> { ::Setting.noindex } setting :noai, default: true setting :bio_markdown, default: false + setting :discoverable_local, default: false setting :hide_statuses_count, default: false setting :hide_following_count, default: false setting :hide_followers_count, default: false diff --git a/app/serializers/activitypub/actor_serializer.rb b/app/serializers/activitypub/actor_serializer.rb index b01b434688..05bfe73ed0 100644 --- a/app/serializers/activitypub/actor_serializer.rb +++ b/app/serializers/activitypub/actor_serializer.rb @@ -96,6 +96,14 @@ class ActivityPub::ActorSerializer < ActivityPub::Serializer end def discoverable + if object.local? + object.user&.setting_discoverable_local ? false : original_discoverable + else + original_discoverable + end + end + + def original_discoverable object.suspended? ? false : (object.discoverable || false) end diff --git a/app/services/update_account_service.rb b/app/services/update_account_service.rb index 625097a16d..a3272e603f 100644 --- a/app/services/update_account_service.rb +++ b/app/services/update_account_service.rb @@ -10,6 +10,11 @@ class UpdateAccountService < BaseService params.delete(:bio_markdown) account.user.send(update_method, user_params) end + if account.user && params.key?(:discoverable_local) + user_params = { settings_attributes: { discoverable_local: params['discoverable_local'] } } + params.delete(:discoverable_local) + account.user.send(update_method, user_params) + end account.send(update_method, params).tap do |ret| next unless ret diff --git a/app/views/settings/profiles/show.html.haml b/app/views/settings/profiles/show.html.haml index cd08c25e5e..affa6f1a2d 100644 --- a/app/views/settings/profiles/show.html.haml +++ b/app/views/settings/profiles/show.html.haml @@ -64,6 +64,10 @@ .fields-group = f.input :discoverable, as: :boolean, wrapper: :with_label, hint: t('simple_form.hints.defaults.discoverable'), recommended: true + = f.simple_fields_for :settings, current_user.settings do |ff| + .fields-group + = ff.input :discoverable_local, input_html: { name: 'account[discoverable_local]' }, wrapper: :with_label, kmyblue: true, label: I18n.t('simple_form.labels.defaults.discoverable_local'), hint: I18n.t('simple_form.hints.defaults.discoverable_local') + .fields-group = f.input :locked, as: :boolean, wrapper: :with_label, hint: t('simple_form.hints.defaults.locked') diff --git a/config/locales/simple_form.ja.yml b/config/locales/simple_form.ja.yml index a0247284a2..83ffa50ba1 100644 --- a/config/locales/simple_form.ja.yml +++ b/config/locales/simple_form.ja.yml @@ -41,6 +41,7 @@ ja: current_username: 確認のため、現在のアカウントのユーザー名を入力してください digest: 長期間使用していない場合と不在時に返信を受けた場合のみ送信されます discoverable: レコメンド、トレンド、その他の機能により、あなたのアカウントを他の人から見つけられるようにします + discoverable_local: 上記設定を当サーバー内でのみ適用するようにします dissubscribable: あなたの投稿はすべてのアンテナに掲載されなくなります。Misskeyのアンテナを拒否することはできません。Mastodonの一部のサーバーもこの設定に対応しますが、挙動が一部kmyblueと異なる場合があります email: 確認のメールが送信されます group: このアカウントに送られたメンションは自動でBTされ、フォローしている全てのアカウントに配信されます @@ -192,6 +193,7 @@ ja: current_password: 現在のパスワード data: データ discoverable: ディレクトリに掲載する + discoverable_local: 他サーバーのディレクトリに掲載しない display_name: 表示名 dissubscribable: 購読を拒否する email: メールアドレス