From 0c3729562448c24302db8b3ab25310e918721dd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?KMY=EF=BC=88=E9=9B=AA=E3=81=82=E3=81=99=E3=81=8B=EF=BC=89?= Date: Wed, 31 Jul 2024 13:01:36 +0900 Subject: [PATCH] =?UTF-8?q?Remove:=20#609=20=E3=83=AD=E3=83=BC=E3=82=AB?= =?UTF-8?q?=E3=83=AB=E3=83=A6=E3=83=BC=E3=82=B6=E3=83=BC=E8=A8=AD=E5=AE=9A?= =?UTF-8?q?=E3=81=8B=E3=82=89=E8=B3=BC=E8=AA=AD=E8=A8=B1=E5=8F=AF=E3=82=92?= =?UTF-8?q?=E5=89=8A=E9=99=A4=20(#782)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * #609 ローカルユーザー設定から購読許可を削除 * Fix test * Fix test --- .../api/v1/accounts/credentials_controller.rb | 1 - .../settings/privacy_extra_controller.rb | 2 +- .../settings/profiles_controller.rb | 3 +- app/lib/activitypub/tag_manager.rb | 11 -- .../concerns/account/master_settings.rb | 2 + app/models/concerns/user/has_settings.rb | 4 - app/models/user_settings.rb | 1 - .../activitypub/actor_serializer.rb | 8 +- .../settings/preferences/other/show.html.haml | 3 - .../settings/privacy_extra/show.html.haml | 15 --- config/i18n-tasks.yml | 1 + config/locales/en.yml | 2 - config/locales/ja.yml | 2 - config/locales/simple_form.en.yml | 12 -- config/locales/simple_form.ja.yml | 8 -- .../services/fan_out_on_write_service_spec.rb | 103 +++++------------- 16 files changed, 33 insertions(+), 145 deletions(-) diff --git a/app/controllers/api/v1/accounts/credentials_controller.rb b/app/controllers/api/v1/accounts/credentials_controller.rb index a0c6d24df66b25..7488fdec7c7afb 100644 --- a/app/controllers/api/v1/accounts/credentials_controller.rb +++ b/app/controllers/api/v1/accounts/credentials_controller.rb @@ -32,7 +32,6 @@ def account_params :bot, :discoverable, :searchability, - :dissubscribable, :hide_collections, :indexable, fields_attributes: [:name, :value] diff --git a/app/controllers/settings/privacy_extra_controller.rb b/app/controllers/settings/privacy_extra_controller.rb index 49c71d50714f9a..54cedf2c4b803e 100644 --- a/app/controllers/settings/privacy_extra_controller.rb +++ b/app/controllers/settings/privacy_extra_controller.rb @@ -18,7 +18,7 @@ def update private def account_params - params.require(:account).permit(:subscription_policy, settings: UserSettings.keys) + params.require(:account).permit(settings: UserSettings.keys) end def set_account diff --git a/app/controllers/settings/profiles_controller.rb b/app/controllers/settings/profiles_controller.rb index a023b073b39e10..dc759a060b263e 100644 --- a/app/controllers/settings/profiles_controller.rb +++ b/app/controllers/settings/profiles_controller.rb @@ -20,8 +20,7 @@ def update private def account_params - # params.require(:account).permit(:display_name, :note, :bio_markdown, :avatar, :header, :locked, :my_actor_type, :searchability, :dissubscribable, :discoverable, :discoverable_local, :hide_collections, fields_attributes: [:name, :value]) - params.require(:account).permit(:display_name, :note, :bio_markdown, :avatar, :header, :bot, :my_actor_type, :dissubscribable, fields_attributes: [:name, :value]) + params.require(:account).permit(:display_name, :note, :bio_markdown, :avatar, :header, :bot, :my_actor_type, fields_attributes: [:name, :value]) end def set_account diff --git a/app/lib/activitypub/tag_manager.rb b/app/lib/activitypub/tag_manager.rb index 5cf7a671337268..84e5ea547da365 100644 --- a/app/lib/activitypub/tag_manager.rb +++ b/app/lib/activitypub/tag_manager.rb @@ -242,17 +242,6 @@ def limited_scope(status) end end - def subscribable_by(account) - case account.subscription_policy - when :allow - [COLLECTIONS[:public]] - when :followers_only - [account_followers_url(account)] - else - [] - end - end - def searchable_by(status) searchable_by = case status.compute_searchability_activitypub diff --git a/app/models/concerns/account/master_settings.rb b/app/models/concerns/account/master_settings.rb index 90c61a06d2324d..b0d8a1b8a7b39a 100644 --- a/app/models/concerns/account/master_settings.rb +++ b/app/models/concerns/account/master_settings.rb @@ -5,6 +5,8 @@ module Account::MasterSettings included do def subscription_policy + return :allow if local? + return master_settings['subscription_policy']&.to_sym || :allow if master_settings.present? # allow, followers_only, block diff --git a/app/models/concerns/user/has_settings.rb b/app/models/concerns/user/has_settings.rb index 2936bc0ba42d5a..61c2fe4a1f7e31 100644 --- a/app/models/concerns/user/has_settings.rb +++ b/app/models/concerns/user/has_settings.rb @@ -143,10 +143,6 @@ def setting_dtl_force_searchability settings['dtl_force_searchability']&.to_sym || :unchange end - def setting_dtl_force_subscribable - settings['dtl_force_subscribable'] - end - def setting_hide_statuses_count settings['hide_statuses_count'] end diff --git a/app/models/user_settings.rb b/app/models/user_settings.rb index 505514307ae57a..9af2950aad8aad 100644 --- a/app/models/user_settings.rb +++ b/app/models/user_settings.rb @@ -39,7 +39,6 @@ class KeyError < Error; end setting :slip_local_emoji_reaction, default: false setting :dtl_force_visibility, default: :unchange, in: %w(unchange public public_unlisted unlisted) setting :dtl_force_searchability, default: :unchange, in: %w(unchange public public_unlisted) - setting :dtl_force_subscribable, default: false setting :lock_follow_from_bot, default: false setting :allow_quote, default: true setting :reject_send_limited_to_suspects, default: false diff --git a/app/serializers/activitypub/actor_serializer.rb b/app/serializers/activitypub/actor_serializer.rb index 73fd17238ed269..3c3b478862946f 100644 --- a/app/serializers/activitypub/actor_serializer.rb +++ b/app/serializers/activitypub/actor_serializer.rb @@ -7,14 +7,14 @@ class ActivityPub::ActorSerializer < ActivityPub::Serializer context :security context_extensions :manually_approves_followers, :featured, :also_known_as, - :moved_to, :property_value, :discoverable, :olm, :suspended, :searchable_by, :subscribable_by, + :moved_to, :property_value, :discoverable, :olm, :suspended, :searchable_by, :other_setting, :memorial, :indexable attributes :id, :type, :following, :followers, :inbox, :outbox, :featured, :featured_tags, :preferred_username, :name, :summary, :url, :manually_approves_followers, - :discoverable, :indexable, :published, :memorial, :searchable_by, :subscribable_by, :other_setting + :discoverable, :indexable, :published, :memorial, :searchable_by, :other_setting has_one :public_key, serializer: ActivityPub::PublicKeySerializer @@ -179,10 +179,6 @@ def searchable_by ActivityPub::TagManager.instance.account_searchable_by(object) end - def subscribable_by - ActivityPub::TagManager.instance.subscribable_by(object) - end - def other_setting config = object.public_settings config.map do |k, v| diff --git a/app/views/settings/preferences/other/show.html.haml b/app/views/settings/preferences/other/show.html.haml index 8b7aca9a8d92f6..c89afe83c0a05b 100644 --- a/app/views/settings/preferences/other/show.html.haml +++ b/app/views/settings/preferences/other/show.html.haml @@ -90,9 +90,6 @@ label_method: ->(item) { safe_join([t("simple_form.labels.dtl_force_searchability.#{item}")]) }, wrapper: :with_floating_label - .fields-group - = ff.input :dtl_force_subscribable, wrapper: :with_label, kmyblue: true, label: I18n.t('simple_form.labels.defaults.setting_dtl_force_subscribable'), hint: I18n.t('simple_form.hints.defaults.setting_dtl_force_subscribable') - %h4= t 'preferences.public_timelines' .fields-group diff --git a/app/views/settings/privacy_extra/show.html.haml b/app/views/settings/privacy_extra/show.html.haml index fc7ed4db5230e7..7cc74452242f6c 100644 --- a/app/views/settings/privacy_extra/show.html.haml +++ b/app/views/settings/privacy_extra/show.html.haml @@ -36,20 +36,5 @@ .fields-group = ff.input :reject_send_limited_to_suspects, kmyblue: true, as: :boolean, wrapper: :with_label, label: I18n.t('simple_form.labels.defaults.setting_reject_send_limited_to_suspects'), hint: I18n.t('simple_form.hints.defaults.setting_reject_send_limited_to_suspects') - %h4= t('privacy_extra.will_remove_settings') - %p.hint= t('privacy_extra.will_remove_settings_hint_html') - - .fields-group - = f.input :subscription_policy, - as: :radio_buttons, - collection: %w(allow followers_only block), - collection_wrapper_tag: 'ul', - hint: t('simple_form.hints.defaults.subscription_policy'), - item_wrapper_tag: 'li', - kmyblue: true, - label: t('simple_form.labels.defaults.subscription_policy'), - label_method: ->(item) { safe_join([t("simple_form.labels.subscription_policy.#{item}")]) }, - wrapper: :with_floating_label - .actions = f.button :button, t('generic.save_changes'), type: :submit diff --git a/config/i18n-tasks.yml b/config/i18n-tasks.yml index 10e99cb8646421..328d5c74dbaead 100644 --- a/config/i18n-tasks.yml +++ b/config/i18n-tasks.yml @@ -43,6 +43,7 @@ ignore_missing: - 'application_mailer.salutation' - 'errors.500' - 'auth.providers.*' + - 'antennas.index.{accounts,domains,keywords,tags}' ignore_unused: - 'activemodel.errors.*' diff --git a/config/locales/en.yml b/config/locales/en.yml index 91fd33ec038120..4ee094ee398c02 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1913,8 +1913,6 @@ en: stop_deliver: Stop delivery stop_deliver_hint_html: Mastodon posts can be freely searched by other software; privacy settings made within Mastodon will be ignored and your posts may be found by unintended people. Here, you can set up your posts so that they will not be found by other servers or software. However, there is a risk involved. title: Privacy extra settings - will_remove_settings: This function will be removed - will_remove_settings_hint_html: This function will be removed kb14.0 or next LTS. privacy_policy: title: Privacy Policy reactions: diff --git a/config/locales/ja.yml b/config/locales/ja.yml index 8215d8584a6302..0849c954282fa1 100644 --- a/config/locales/ja.yml +++ b/config/locales/ja.yml @@ -1870,8 +1870,6 @@ ja: stop_deliver: 配送制限 stop_deliver_hint_html: Mastodonの投稿を、他のソフトウェアでは自由に検索することができます。Mastodon内で行ったプライバシーの設定は無視され、あなたの投稿が意図しない人に見つかるおそれがあります。ここでは、他のサーバーやソフトウェアであなたの投稿が見つからないようにする設定が可能です。ただしリスクは伴います。 title: プライバシー追加設定 - will_remove_settings: 削除予定の設定 - will_remove_settings_hint_html: これらの設定は、慎重に検討を重ねた結果、バージョン14または次のLTSのどちらか早い方で削除される予定です。代替の設定はありませんので、ご承知おきください。 privacy_policy: title: プライバシーポリシー reactions: diff --git a/config/locales/simple_form.en.yml b/config/locales/simple_form.en.yml index b33801d6fb21ce..fa49e2b7f00834 100644 --- a/config/locales/simple_form.en.yml +++ b/config/locales/simple_form.en.yml @@ -69,7 +69,6 @@ en: setting_display_media_hide_all: Always hide media setting_display_media_show_all: Always show media setting_dtl_force_searchability: 'With using #%{tag} tag, your post settings will be changed forcibly' - setting_dtl_force_subscribable: Your post can be detected local user's antenna to subscribe deep timeline setting_dtl_force_visibility: 'With using #%{tag} tag, your post settings will be changed forcibly' setting_emoji_reaction_policy: Even with this setting, users on other servers are free to put their emoji reaction on the post and share it within the same server. If you simply want to remove the emoji reaction from your own screen, you can disable it from the appearance settings setting_emoji_reaction_streaming_notify_impl2: 当該サーバーの独自機能に対応したアプリを利用時に、絵文字リアクション機能を利用できます。動作確認していないため(そもそもそのようなアプリ自体を確認できていないため)正しく動かない場合があります @@ -85,7 +84,6 @@ en: setting_stop_emoji_reaction_streaming: Helps to save communication capacity. setting_use_blurhash: Gradients are based on the colors of the hidden visuals but obfuscate any details setting_use_pending_items: Hide timeline updates behind a click instead of automatically scrolling the feed - subscription_policy: Your post is not picked by antenna username: You can use letters, numbers, and underscores whole_word: When the keyword or phrase is alphanumeric only, it will only be applied if it matches the whole word domain_allow: @@ -162,10 +160,6 @@ en: settings: indexable: Your profile page may appear in search results on Google, Bing, and others. show_application: You will always be able to see which app published your post regardless. - subscription_policy: - allow: Allow - block: Block - followers_only: Followers only tag: name: You can only change the casing of the letters, for example, to make it more readable user: @@ -278,7 +272,6 @@ en: setting_display_media_hide_all: Hide all setting_display_media_show_all: Show all setting_dtl_force_searchability: Post searchability - setting_dtl_force_subscribable: Ignore your subscribability setting when using the DTL tag setting_dtl_force_visibility: Post visibility setting_dtl_menu: Show DTL menu on web setting_emoji_reaction_policy: Emoji reaction receive/display policy @@ -330,7 +323,6 @@ en: setting_use_public_index: Include permitted accounts post to results of search severity: Severity sign_in_token_attempt: Security code - subscription_policy: Subscribability title: Title type: Import type username: Username @@ -451,10 +443,6 @@ en: settings: indexable: Include profile page in search engines show_application: Display from which app you sent a post - subscription_policy: - allow: 全員に許可 - block: 全員拒否 - followers_only: フォロワーにのみ許可 tag: listable: Allow this hashtag to appear in searches and suggestions name: Hashtag diff --git a/config/locales/simple_form.ja.yml b/config/locales/simple_form.ja.yml index 7b54937a6b1a45..fd343625ec112f 100644 --- a/config/locales/simple_form.ja.yml +++ b/config/locales/simple_form.ja.yml @@ -69,7 +69,6 @@ ja: setting_display_media_hide_all: メディアを常に隠す setting_display_media_show_all: メディアを常に表示する setting_dtl_force_searchability: 'ハッシュタグ #%{tag} をつけて投稿するとき、検索許可を強制的に置き換えるかを設定します' - setting_dtl_force_subscribable: 購読拒否設定に関係なく、ディープタイムラインに向けた投稿はアンテナに掲載されます。ディープタイムラインをアンテナ経由で閲覧している人にあなたの発言が届きます setting_dtl_force_visibility: 'ハッシュタグ #%{tag} をつけて投稿するとき、公開範囲を強制的に置き換えるかを設定します' setting_emoji_reaction_policy: この設定をしても他のサーバーのユーザーはその投稿に自由に絵文字をつけ、同じサーバーの中で共有できます。単にあなた自身の画面から絵文字リアクションを除去したいだけなら、外観設定から絵文字リアクションを無効にすることができます setting_emoji_reaction_streaming_notify_impl2: 当該サーバーの独自機能に対応したアプリを利用時に、絵文字リアクション機能を利用できます。動作確認していないため(そもそもそのようなアプリ自体を確認できていないため)正しく動かない場合があります @@ -85,7 +84,6 @@ ja: setting_stop_emoji_reaction_streaming: 通信容量の節約に役立ちます setting_use_blurhash: ぼかしはメディアの色を元に生成されますが、細部は見えにくくなっています setting_use_pending_items: 新着があってもタイムラインを自動的にスクロールしないようにします - subscription_policy: あなたの投稿はこの設定の範囲外にあるアカウントのアンテナに掲載されなくなります。Misskeyのアンテナを拒否することはできません。Mastodonの一部のサーバーもこの設定に対応しますが、挙動が一部kmyblueと異なる場合があります username: アルファベット大文字と小文字、数字、アンダーバー「_」が使えます whole_word: キーワードまたはフレーズが英数字のみの場合、単語全体と一致する場合のみ適用されるようになります domain_allow: @@ -274,7 +272,6 @@ ja: setting_display_media_hide_all: 非表示 setting_display_media_show_all: 表示 setting_dtl_force_searchability: DTL投稿の検索許可 - setting_dtl_force_subscribable: ディープタイムライン用のハッシュタグを購読するアンテナに限り、購読拒否設定を無視する setting_dtl_force_visibility: DTL投稿の公開範囲 setting_dtl_menu: Webクライアントのメニューにディープタイムラインを追加する setting_emoji_reaction_policy: 絵文字リアクション受け入れと表示設定 @@ -326,7 +323,6 @@ ja: setting_use_public_index: Mastodonの標準設定によって検索が許可されたアカウントの公開投稿を検索結果に含める severity: 重大性 sign_in_token_attempt: セキュリティコード - subscription_policy: 購読許可 title: タイトル type: インポートする項目 username: ユーザー名 @@ -447,10 +443,6 @@ ja: settings: indexable: 検索エンジンからアクセスできるようにする show_application: 投稿に使ったアプリを開示する - subscription_policy: - allow: 全員に許可 - block: 全員拒否 - followers_only: フォロワーにのみ許可 tag: listable: 検索とディレクトリへの使用を許可する name: ハッシュタグ diff --git a/spec/services/fan_out_on_write_service_spec.rb b/spec/services/fan_out_on_write_service_spec.rb index 18a235238fc4e8..1610a0b7873f51 100644 --- a/spec/services/fan_out_on_write_service_spec.rb +++ b/spec/services/fan_out_on_write_service_spec.rb @@ -129,27 +129,39 @@ def antenna_with_options(owner, **options) expect(antenna_feed_of(empty_antenna)).to_not include status.id end - context 'when subscription is blocked' do - let(:subscription_policy) { :block } + context 'with subscription policy' do + context 'when subscription is blocked' do + let(:subscription_policy) { :block } + let(:alice) { Fabricate(:account, domain: 'example.com', uri: 'https://example.com/alice', subscription_policy: subscription_policy) } - it 'is not added to the antenna feed', :inline_jobs do - expect(antenna_feed_of(antenna)).to_not include status.id + it 'is not added to the antenna feed', :inline_jobs do + expect(antenna_feed_of(antenna)).to_not include status.id + end end - end - context 'when subscription is allowed followers only' do - let(:subscription_policy) { :followers_only } - let!(:antenna) { antenna_with_account(ohagi, alice) } + context 'when local user subscription policy is disabled' do + let(:subscription_policy) { :block } - it 'is not added to the antenna feed', :inline_jobs do - expect(antenna_feed_of(antenna)).to_not include status.id + it 'is added to the antenna feed', :inline_jobs do + expect(antenna_feed_of(antenna)).to include status.id + end end - context 'with following' do - let!(:antenna) { antenna_with_account(bob, alice) } + context 'when subscription is allowed followers only' do + let(:subscription_policy) { :followers_only } + let!(:antenna) { antenna_with_account(ohagi, alice) } + let(:alice) { Fabricate(:account, domain: 'example.com', uri: 'https://example.com/alice', subscription_policy: subscription_policy) } - it 'is added to the antenna feed', :inline_jobs do - expect(antenna_feed_of(antenna)).to include status.id + it 'is not added to the antenna feed', :inline_jobs do + expect(antenna_feed_of(antenna)).to_not include status.id + end + + context 'with following' do + let!(:antenna) { antenna_with_account(bob, alice) } + + it 'is added to the antenna feed', :inline_jobs do + expect(antenna_feed_of(antenna)).to include status.id + end end end end @@ -168,29 +180,6 @@ def antenna_with_options(owner, **options) expect(antenna_feed_of(antenna)).to include status.id end end - - context 'with listening tag but sender is limiting subscription' do - let(:subscription_policy) { :block } - - it 'does not add to the antenna feed', :inline_jobs do - expect(antenna_feed_of(antenna)).to_not include status.id - end - end - - context 'with listening tag but sender is limiting subscription but permit dtl only' do - let(:subscription_policy) { :block } - let(:custom_before) { true } - - before do - alice.user.settings['dtl_force_subscribable'] = true - alice.user.save! - subject.call(status) - end - - it 'is added to the antenna feed', :inline_jobs do - expect(antenna_feed_of(antenna)).to include status.id - end - end end end @@ -203,14 +192,6 @@ def antenna_with_options(owner, **options) expect(antenna_feed_of(empty_antenna)).to_not include status.id end - context 'when subscription is blocked' do - let(:subscription_policy) { :block } - - it 'is added to the antenna feed', :inline_jobs do - expect(antenna_feed_of(antenna)).to include status.id - end - end - context 'when local timeline is disabled' do let(:ltl_enabled) { false } @@ -230,14 +211,6 @@ def antenna_with_options(owner, **options) expect(antenna_feed_of(empty_antenna)).to_not include status.id end - context 'when subscription is blocked' do - let(:subscription_policy) { :block } - - it 'is added to the antenna feed', :inline_jobs do - expect(antenna_feed_of(antenna)).to include status.id - end - end - context 'when local timeline is disabled' do let(:ltl_enabled) { false } @@ -438,14 +411,6 @@ def antenna_with_options(owner, **options) expect(antenna_feed_of(antenna)).to include status.id expect(antenna_feed_of(empty_antenna)).to_not include status.id end - - context 'when subscription is blocked' do - let(:subscription_policy) { :block } - - it 'is not added to the antenna feed', :inline_jobs do - expect(antenna_feed_of(antenna)).to_not include status.id - end - end end context 'with STL antenna' do @@ -457,14 +422,6 @@ def antenna_with_options(owner, **options) expect(antenna_feed_of(empty_antenna)).to_not include status.id end - context 'when subscription is blocked' do - let(:subscription_policy) { :block } - - it 'is added to the antenna feed', :inline_jobs do - expect(antenna_feed_of(antenna)).to include status.id - end - end - context 'when local timeline is disabled' do let(:ltl_enabled) { false } @@ -484,14 +441,6 @@ def antenna_with_options(owner, **options) expect(antenna_feed_of(empty_antenna)).to_not include status.id end - context 'when subscription is blocked' do - let(:subscription_policy) { :block } - - it 'is added to the antenna feed', :inline_jobs do - expect(antenna_feed_of(antenna)).to include status.id - end - end - context 'when local timeline is disabled' do let(:ltl_enabled) { false }