1
0
Fork 0
forked from gitea/nas

Merge remote-tracking branch 'parent/stable-4.3' into kb-draft-15.0-lts

This commit is contained in:
KMY 2024-10-09 07:48:54 +09:00
commit eff82af854
103 changed files with 1199 additions and 762 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)