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

This commit is contained in:
KMY 2024-10-05 09:10:58 +09:00
commit 66bed31dbe
226 changed files with 2688 additions and 1846 deletions

View file

@ -30,42 +30,38 @@ RSpec.describe RemoveStatusService, :inline_jobs do
Fabricate(:status, account: bill, reblog: status, uri: 'hoge')
end
it 'removes status from author\'s home feed' do
subject.call(status)
expect(HomeFeed.new(alice).get(10).pluck(:id)).to_not include(status.id)
end
it 'removes status from local follower\'s home feed' do
subject.call(status)
expect(HomeFeed.new(jeff).get(10).pluck(:id)).to_not include(status.id)
end
it 'publishes to public media timeline' do
it 'removes status from notifications and from author and local follower home feeds, publishes to media timeline, sends delete activities' do
allow(redis).to receive(:publish).with(any_args)
subject.call(status)
expect { subject.call(status) }
.to remove_status_from_notifications
expect(redis).to have_received(:publish).with('timeline:public:media', Oj.dump(event: :delete, payload: status.id.to_s))
end
expect(home_feed_ids(alice))
.to_not include(status.id)
expect(home_feed_ids(jeff))
.to_not include(status.id)
it 'sends Delete activity to followers' do
subject.call(status)
expect(redis)
.to have_received(:publish).with('timeline:public:media', Oj.dump(event: :delete, payload: status.id.to_s))
expect(delete_delivery(hank, status))
.to have_been_made.once
end
it 'sends Delete activity to rebloggers' do
subject.call(status)
expect(delete_delivery(bill, status))
.to have_been_made.once
end
it 'remove status from notifications' do
expect { subject.call(status) }.to change {
Notification.where(activity_type: 'Favourite', from_account: jeff, account: alice).count
}.from(1).to(0)
def home_feed_ids(personage)
HomeFeed
.new(personage)
.get(10)
.pluck(:id)
end
def remove_status_from_notifications
change { Notification.where(activity_type: 'Favourite', from_account: jeff, account: alice).count }
.from(1)
.to(0)
end
def delete_delivery(target, status)