Merge remote-tracking branch 'parent/main' into upstream-20240618

This commit is contained in:
KMY 2024-06-18 07:43:33 +09:00
commit aa2cdc898a
271 changed files with 1839 additions and 1397 deletions

View file

@ -50,30 +50,16 @@ RSpec.describe RemoveStatusService, :sidekiq_inline do
it 'sends Delete activity to followers' do
subject.call(status)
expect(a_request(:post, hank.shared_inbox_url).with(
body: hash_including({
'type' => 'Delete',
'object' => {
'type' => 'Tombstone',
'id' => ActivityPub::TagManager.instance.uri_for(status),
'atomUri' => OStatus::TagManager.instance.uri_for(status),
},
})
)).to have_been_made.once
expect(delete_delivery(hank, status))
.to have_been_made.once
end
it 'sends Delete activity to rebloggers' do
subject.call(status)
expect(a_request(:post, bill.shared_inbox_url).with(
body: hash_including({
'type' => 'Delete',
'object' => {
'type' => 'Tombstone',
'id' => ActivityPub::TagManager.instance.uri_for(status),
'atomUri' => OStatus::TagManager.instance.uri_for(status),
},
})
)).to have_been_made.once
expect(delete_delivery(bill, status))
.to have_been_made.once
end
it 'remove status from notifications' do
@ -81,6 +67,22 @@ RSpec.describe RemoveStatusService, :sidekiq_inline do
Notification.where(activity_type: 'Favourite', from_account: jeff, account: alice).count
}.from(1).to(0)
end
def delete_delivery(target, status)
a_request(:post, target.shared_inbox_url)
.with(body: delete_activity_for(status))
end
def delete_activity_for(status)
hash_including(
'type' => 'Delete',
'object' => {
'type' => 'Tombstone',
'id' => ActivityPub::TagManager.instance.uri_for(status),
'atomUri' => OStatus::TagManager.instance.uri_for(status),
}
)
end
end
context 'when removed status is null-searchability' do
@ -141,6 +143,7 @@ RSpec.describe RemoveStatusService, :sidekiq_inline do
it 'do not send Delete activity to followers', :sidekiq_inline do
subject.call(status)
expect(a_request(:post, hank.inbox_url)).to_not have_been_made
expect(a_request(:post, hank.shared_inbox_url)).to_not have_been_made
end
@ -152,15 +155,9 @@ RSpec.describe RemoveStatusService, :sidekiq_inline do
it 'sends Undo activity to followers' do
subject.call(status)
expect(a_request(:post, hank.shared_inbox_url).with(
body: hash_including({
'type' => 'Undo',
'object' => hash_including({
'type' => 'Announce',
'object' => ActivityPub::TagManager.instance.uri_for(original_status),
}),
})
)).to have_been_made.once
expect(undo_delivery(hank, original_status))
.to have_been_made.once
end
end
@ -170,15 +167,9 @@ RSpec.describe RemoveStatusService, :sidekiq_inline do
it 'sends Undo activity to followers' do
subject.call(status)
expect(a_request(:post, hank.shared_inbox_url).with(
body: hash_including({
'type' => 'Undo',
'object' => hash_including({
'type' => 'Announce',
'object' => ActivityPub::TagManager.instance.uri_for(original_status),
}),
})
)).to have_been_made.once
expect(undo_delivery(hank, original_status))
.to have_been_made.once
end
end
@ -188,15 +179,24 @@ RSpec.describe RemoveStatusService, :sidekiq_inline do
it 'sends Undo activity to followers' do
subject.call(status)
expect(a_request(:post, bill.shared_inbox_url).with(
body: hash_including({
'type' => 'Undo',
'object' => hash_including({
'type' => 'Announce',
'object' => ActivityPub::TagManager.instance.uri_for(original_status),
}),
})
)).to have_been_made.once
expect(undo_delivery(bill, original_status))
.to have_been_made.once
end
end
def undo_delivery(target, status)
a_request(:post, target.shared_inbox_url)
.with(body: undo_activity_for(status))
end
def undo_activity_for(status)
hash_including(
'type' => 'Undo',
'object' => hash_including(
'type' => 'Announce',
'object' => ActivityPub::TagManager.instance.uri_for(status)
)
)
end
end