1
0
Fork 0
forked from gitea/nas

Remove: #609 ローカルユーザー設定から購読許可を削除 (#782)

* #609 ローカルユーザー設定から購読許可を削除

* Fix test

* Fix test
This commit is contained in:
KMY(雪あすか) 2024-07-31 13:01:36 +09:00 committed by GitHub
parent ec60b68608
commit 0c37295624
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 34 additions and 146 deletions

View file

@ -32,7 +32,6 @@ class Api::V1::Accounts::CredentialsController < Api::BaseController
:bot,
:discoverable,
:searchability,
:dissubscribable,
:hide_collections,
:indexable,
fields_attributes: [:name, :value]

View file

@ -18,7 +18,7 @@ class Settings::PrivacyExtraController < Settings::BaseController
private
def account_params
params.require(:account).permit(:subscription_policy, settings: UserSettings.keys)
params.require(:account).permit(settings: UserSettings.keys)
end
def set_account

View file

@ -20,8 +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, :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

View file

@ -242,17 +242,6 @@ class ActivityPub::TagManager
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

View file

@ -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

View file

@ -143,10 +143,6 @@ module User::HasSettings
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

View file

@ -39,7 +39,6 @@ class UserSettings
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

View file

@ -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 @@ class ActivityPub::ActorSerializer < ActivityPub::Serializer
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|

View file

@ -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

View file

@ -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

View file

@ -43,6 +43,7 @@ ignore_missing:
- 'application_mailer.salutation'
- 'errors.500'
- 'auth.providers.*'
- 'antennas.index.{accounts,domains,keywords,tags}'
ignore_unused:
- 'activemodel.errors.*'

View file

@ -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:

View file

@ -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:

View file

@ -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

View file

@ -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: ハッシュタグ

View file

@ -129,29 +129,41 @@ RSpec.describe FanOutOnWriteService do
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
end
end
context 'when subscription is allowed followers only' do
let(:subscription_policy) { :followers_only }
let!(:antenna) { antenna_with_account(ohagi, alice) }
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
context 'with following' do
let!(:antenna) { antenna_with_account(bob, alice) }
context 'when local user subscription policy is disabled' 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 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 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
context 'when dtl post' do
@ -168,29 +180,6 @@ RSpec.describe FanOutOnWriteService do
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 @@ RSpec.describe FanOutOnWriteService do
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 @@ RSpec.describe FanOutOnWriteService do
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 @@ RSpec.describe FanOutOnWriteService do
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 @@ RSpec.describe FanOutOnWriteService do
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 @@ RSpec.describe FanOutOnWriteService do
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 }