1
0
Fork 0
forked from gitea/nas

Add: #8 サークル投稿の転送 (#294)

* Add: `conversations`テーブルに`ancestor_status`プロパティ

* Fix test

* Fix test more

* Add: `limited_visibility`に`Reply`を追加、`context`のURI

* Add: 外部からの`context`受信処理

* Fix test

* Add: 公開範囲「返信」

* Fix test

* Fix: 返信に返信以外の公開範囲を設定できない問題

* Add: ローカル投稿時にメンション追加・他サーバーへの転送

* Fix test

* Fix test

* Test: ローカルスレッドへの返信投稿の転送

* Test: 未知のアカウントからのメンション

* Add: 編集・削除の連合に対応

* Remove: 重複テスト

* Fix: 改善

* Add: 編集削除の転送処理・返信なのにsilentなメンションでの通知

* Fix: リプライが第三者に届かない問題

* Add: `always_sign_unsafe`

* Add: Subject

* Remove space

* Fix: 他人のスレッドの送信先一覧を非表示

* Fix: おかしいコード
This commit is contained in:
KMY(雪あすか) 2023-11-30 09:29:24 +09:00 committed by GitHub
parent a52a8ce214
commit a88349af55
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
42 changed files with 1115 additions and 77 deletions

View file

@ -63,6 +63,22 @@ describe ActivityPub::DistributionWorker do
end
end
context 'with limited response status' do
before do
allow(ActivityPub::DeliveryWorker).to receive(:perform_async).with(kind_of(String), status.account.id, 'http://example.com/conversation/inbox', anything)
status.update(visibility: :limited, thread: Fabricate(:status))
status.conversation.update(uri: 'https://example.com/conversation', inbox_url: 'http://example.com/conversation/inbox')
status.capability_tokens.create!
status.mentions.create!(account: follower, silent: true)
stub_request(:post, 'http://example.com/conversation/inbox')
end
it 'delivers to followers' do
subject.perform(status.id)
expect(ActivityPub::DeliveryWorker).to have_received(:perform_async)
end
end
context 'with limited status for no-follower but non-mentioned follower' do
let(:no_follower) { Fabricate(:account, domain: 'example.com', inbox_url: 'http://example.com/no_follower/inbox', shared_inbox_url: 'http://example.com') }

View file

@ -6,7 +6,7 @@ describe ActivityPub::StatusUpdateDistributionWorker do
subject { described_class.new }
let(:status) { Fabricate(:status, text: 'foo') }
let(:follower) { Fabricate(:account, protocol: :activitypub, inbox_url: 'http://example.com', domain: 'example.com') }
let(:follower) { Fabricate(:account, protocol: :activitypub, shared_inbox_url: 'http://example.com', inbox_url: 'http://example.com/follower/inbox', domain: 'example.com') }
describe '#perform' do
before do
@ -31,6 +31,18 @@ describe ActivityPub::StatusUpdateDistributionWorker do
end
end
context 'with unlisted status' do
before do
status.update(visibility: :unlisted)
end
it 'delivers to followers' do
expect_push_bulk_to_match(ActivityPub::DeliveryWorker, [[kind_of(String), status.account.id, 'http://example.com', anything]]) do
subject.perform(status.id)
end
end
end
context 'with private status' do
before do
status.update(visibility: :private)
@ -42,5 +54,35 @@ describe ActivityPub::StatusUpdateDistributionWorker do
end
end
end
context 'with limited status' do
before do
status.update(visibility: :limited)
status.capability_tokens.create!
status.mentions.create!(account: follower, silent: true)
end
it 'delivers to followers' do
expect_push_bulk_to_match(ActivityPub::DeliveryWorker, [[kind_of(String), status.account.id, 'http://example.com', anything]]) do
subject.perform(status.id)
end
end
end
context 'with limited response status' do
before do
allow(ActivityPub::DeliveryWorker).to receive(:perform_async).with(kind_of(String), status.account.id, 'http://example.com/conversation/inbox', anything)
status.update(visibility: :limited, thread: Fabricate(:status))
status.conversation.update(uri: 'https://example.com/conversation', inbox_url: 'http://example.com/conversation/inbox')
status.capability_tokens.create!
status.mentions.create!(account: follower, silent: true)
stub_request(:post, 'http://example.com/conversation/inbox')
end
it 'delivers to followers' do
subject.perform(status.id)
expect(ActivityPub::DeliveryWorker).to have_received(:perform_async)
end
end
end
end