Add: Misskeyに相互限定投稿を配送しないオプション

This commit is contained in:
KMY 2024-01-24 20:37:27 +09:00
parent 201fd37bc3
commit d87a11bc7d
7 changed files with 55 additions and 14 deletions

View file

@ -127,6 +127,10 @@ module User::HasSettings
settings['allow_quote']
end
def setting_reject_send_limited_to_suspects
settings['reject_send_limited_to_suspects']
end
def setting_noindex
settings['noindex']
end

View file

@ -41,6 +41,7 @@ class UserSettings
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
setting_inverse_alias :indexable, :noindex

View file

@ -105,7 +105,10 @@ class ProcessMentionsService < BaseService
def process_mutual!
mentioned_account_ids = @current_mentions.map(&:account_id)
@status.account.mutuals.reorder(nil).find_each do |target_account|
mutuals = @status.account.mutuals
mutuals = mutuals.where.not(domain: InstanceInfo.where(software: 'misskey').select(:domain)).or(mutuals.where(domain: nil)) if @status.account.user&.setting_reject_send_limited_to_suspects
mutuals.reorder(nil).find_each do |target_account|
@current_mentions << @status.mentions.new(silent: true, account: target_account) unless mentioned_account_ids.include?(target_account.id)
end
end

View file

@ -45,5 +45,8 @@
.fields-group
= ff.input :reject_unlisted_subscription, kmyblue: true, as: :boolean, wrapper: :with_label, label: I18n.t('simple_form.labels.defaults.setting_reject_unlisted_subscription'), hint: I18n.t('simple_form.hints.defaults.setting_reject_unlisted_subscription')
.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')
.actions
= f.button :button, t('generic.save_changes'), type: :submit

View file

@ -282,6 +282,7 @@ en:
setting_public_post_to_unlisted: Convert public post to public unlisted if not using Web app
setting_reduce_motion: Reduce motion in animations
setting_reject_public_unlisted_subscription: Reject sending public unlisted visibility/non-public searchability posts to Misskey, Calckey
setting_reject_send_limited_to_suspects: Reject sending mutual posts to Misskey
setting_reject_unlisted_subscription: Reject sending unlisted visibility/non-public searchability posts to Misskey, Calckey
setting_send_without_domain_blocks: Send your post to all server with administrator set as rejecting-post-server for protect you [DEPRECATED]
setting_show_application: Disclose application used to send posts

View file

@ -80,6 +80,7 @@ ja:
setting_enable_emoji_reaction: この機能を無効にしても、他の人はあなたの投稿にスタンプをつけられます
setting_hide_network: フォローとフォロワーの情報がプロフィールページで見られないようにします
setting_public_post_to_unlisted: 未対応のサードパーティアプリからもローカル公開で投稿できますが、公開投稿はWeb以外できなくなります
setting_reject_send_limited_to_suspects: これは「相互のみ」投稿に適用されます。サークル投稿は例外なく配送されます。一部のMisskeyサーバーが独自に限定投稿へ対応しましたが、相互のみ投稿を行うたびに相手に通知されるなど複数の問題があるため、気になる人向けの設定です
setting_reject_unlisted_subscription: Misskeyやそのフォークは、フォローしていないアカウントの「非収載」投稿を **購読・検索** することができます。これはkmyblueの挙動と異なります。そのようなサーバーに、指定した公開範囲の投稿を「フォロワーのみ」として配送します。ただし構造上、完璧な対応は困難でたまに非収載として配信されること、ご理解ください
setting_show_application: 投稿するのに使用したアプリが投稿の詳細ビューに表示されるようになります
setting_single_ref_to_quote: 当サーバーがまだ対象投稿を取り込んでいない場合、引用が相手に正常に認識されない場合があります
@ -293,6 +294,7 @@ ja:
setting_public_post_to_unlisted: サードパーティから公開範囲「公開」で投稿した場合、「ローカル公開」に変更する
setting_reduce_motion: アニメーションの動きを減らす
setting_reject_public_unlisted_subscription: Misskey系サーバーに「ローカル公開」かつ検索許可「誰でも以外」の投稿を「フォロワーのみ」に変換して配送する
setting_reject_send_limited_to_suspects: Misskey系サーバーに「相互のみ」投稿を配送しない
setting_reject_unlisted_subscription: Misskey系サーバーに「非収載」かつ検索許可「誰でも以外」の投稿を「フォロワーのみ」に変換して配送する
setting_send_without_domain_blocks: 管理人の設定した配送停止設定を拒否する (非推奨)
setting_show_application: 送信したアプリを開示する

View file

@ -192,21 +192,48 @@ RSpec.describe PostStatusService, type: :service do
expect(mention_service).to have_received(:call).with(status, limited_type: '', circle: nil, save_records: false)
end
it 'mutual visibility' do
account = Fabricate(:account)
mutual_account = Fabricate(:account)
other_account = Fabricate(:account)
text = 'This is an English text.'
context 'with mutual visibility' do
let(:sender) { Fabricate(:user).account }
let(:io_account) { Fabricate(:account, domain: 'misskey.io', uri: 'https://misskey.io/actor') }
let(:local_account) { Fabricate(:account) }
let(:remote_account) { Fabricate(:account, domain: 'example.com', uri: 'https://example.com/actor') }
let(:follower) { Fabricate(:account) }
let(:followee) { Fabricate(:account) }
mutual_account.follow!(account)
account.follow!(mutual_account)
other_account.follow!(account)
status = subject.call(account, text: text, visibility: 'mutual')
before do
Fabricate(:instance_info, domain: 'misskey.io', software: 'misskey')
io_account.follow!(sender)
local_account.follow!(sender)
remote_account.follow!(sender)
follower.follow!(sender)
sender.follow!(io_account)
sender.follow!(local_account)
sender.follow!(remote_account)
sender.follow!(followee)
end
expect(status.visibility).to eq 'limited'
expect(status.limited_scope).to eq 'mutual'
expect(status.mentioned_accounts.count).to eq 1
expect(status.mentioned_accounts.first.id).to eq mutual_account.id
it 'visibility is set' do
status = subject.call(sender, text: 'text', visibility: 'mutual')
expect(status.visibility).to eq 'limited'
expect(status.limited_scope).to eq 'mutual'
end
it 'sent to mutuals' do
status = subject.call(sender, text: 'text', visibility: 'mutual')
expect(status.mentioned_accounts.count).to eq 3
expect(status.mentioned_accounts.pluck(:id)).to contain_exactly(io_account.id, local_account.id, remote_account.id)
end
it 'sent to mutuals without misskey.io users' do
sender.user.update!(settings: { reject_send_limited_to_suspects: true })
status = subject.call(sender, text: 'text', visibility: 'mutual')
expect(status.mentioned_accounts.count).to eq 2
expect(status.mentioned_accounts.pluck(:id)).to contain_exactly(local_account.id, remote_account.id)
end
end
it 'limited visibility and direct searchability' do