Remove statuses from antenna timeline when blocked

This commit is contained in:
KMY 2023-08-20 11:43:19 +09:00
parent e336542063
commit 21e590c02b
4 changed files with 53 additions and 0 deletions

View file

@ -0,0 +1,7 @@
# frozen_string_literal: true
Fabricator(:antenna) do
account { Fabricate.build(:account) }
title 'MyString'
list_id 0
end

View file

@ -48,4 +48,23 @@ RSpec.describe AfterBlockService, type: :service do
}.from([status.id.to_s, other_account_status.id.to_s, other_account_reblog.id.to_s]).to([other_account_status.id.to_s])
end
end
describe 'antennas' do
let(:antenna) { Fabricate(:antenna, account: account, list_id: 0) }
let(:antenna_timeline_key) { FeedManager.instance.key(:antenna, antenna.id) }
before do
redis.del(antenna_timeline_key)
end
it "clears account's statuses" do
FeedManager.instance.push_to_antenna(antenna, status)
FeedManager.instance.push_to_antenna(antenna, other_account_status)
FeedManager.instance.push_to_antenna(antenna, other_account_reblog)
expect { subject }.to change {
redis.zrange(antenna_timeline_key, 0, -1)
}.from([status.id.to_s, other_account_status.id.to_s, other_account_reblog.id.to_s]).to([other_account_status.id.to_s])
end
end
end