Add conversation-based forwarding for limited visibility statuses through bearcaps
This commit is contained in:
parent
52157fdcba
commit
7cd4ed7d42
26 changed files with 430 additions and 78 deletions
|
@ -9,6 +9,8 @@ describe ActivityPub::DistributionWorker do
|
|||
describe '#perform' do
|
||||
before do
|
||||
allow(ActivityPub::DeliveryWorker).to receive(:push_bulk)
|
||||
allow(ActivityPub::DeliveryWorker).to receive(:perform_async)
|
||||
|
||||
follower.follow!(status.account)
|
||||
end
|
||||
|
||||
|
@ -34,6 +36,40 @@ describe ActivityPub::DistributionWorker do
|
|||
end
|
||||
end
|
||||
|
||||
context 'with limited status' do
|
||||
before do
|
||||
status.update(visibility: :limited)
|
||||
status.capability_tokens.create!
|
||||
end
|
||||
|
||||
context 'standalone' do
|
||||
before do
|
||||
2.times do |i|
|
||||
status.mentions.create!(silent: true, account: Fabricate(:account, username: "bob#{i}", domain: "example#{i}.com", inbox_url: "https://example#{i}.com/inbox"))
|
||||
end
|
||||
end
|
||||
|
||||
it 'delivers to personal inboxes' do
|
||||
subject.perform(status.id)
|
||||
expect(ActivityPub::DeliveryWorker).to have_received(:push_bulk).with(['https://example0.com/inbox', 'https://example1.com/inbox'])
|
||||
end
|
||||
end
|
||||
|
||||
context 'when it\'s a reply' do
|
||||
let(:conversation) { Fabricate(:conversation, uri: 'https://example.com/123', inbox_url: 'https://example.com/123/inbox') }
|
||||
let(:parent) { Fabricate(:status, visibility: :limited, account: Fabricate(:account, username: 'alice', domain: 'example.com', inbox_url: 'https://example.com/inbox'), conversation: conversation) }
|
||||
|
||||
before do
|
||||
status.update(thread: parent, conversation: conversation)
|
||||
end
|
||||
|
||||
it 'delivers to inbox of conversation only' do
|
||||
subject.perform(status.id)
|
||||
expect(ActivityPub::DeliveryWorker).to have_received(:perform_async).once
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'with direct status' do
|
||||
before do
|
||||
status.update(visibility: :direct)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue