Change list exclusive setting to apply antenna accounts

This commit is contained in:
KMY 2023-09-21 20:42:56 +09:00
parent 2b74bcd6b8
commit 58583cb7bb
2 changed files with 40 additions and 1 deletions

View file

@ -27,6 +27,7 @@ RSpec.describe FeedManager do
let(:bob) { Fabricate(:account, username: 'bob', domain: 'example.com') }
let(:jeff) { Fabricate(:account, username: 'jeff') }
let(:list) { Fabricate(:list, account: alice) }
let(:antenna) { Fabricate(:antenna, account: alice, insert_feeds: true, list: list) }
context 'with home feed' do
it 'returns false for followee\'s status' do
@ -190,6 +191,42 @@ RSpec.describe FeedManager do
reblog = Fabricate(:status, reblog: status, account: jeff)
expect(described_class.instance.filter?(:home, reblog, alice)).to be false
end
it 'returns true for post from followee on exclusive antenna' do
list.exclusive = true
alice.follow!(bob)
antenna.accounts << bob
allow(Antenna).to receive(:where).and_return(antenna)
status = Fabricate(:status, text: 'I post a lot', account: bob)
expect(described_class.instance.filter?(:home, status, alice)).to be true
end
it 'returns true for reblog from followee on exclusive antenna' do
list.exclusive = true
alice.follow!(jeff)
antenna.accounts << jeff
allow(Antenna).to receive(:where).and_return(antenna)
status = Fabricate(:status, text: 'I post a lot', account: bob)
reblog = Fabricate(:status, reblog: status, account: jeff)
expect(described_class.instance.filter?(:home, reblog, alice)).to be true
end
it 'returns false for post from followee on non-exclusive antenna' do
list.exclusive = false
alice.follow!(bob)
antenna.accounts << bob
status = Fabricate(:status, text: 'I post a lot', account: bob)
expect(described_class.instance.filter?(:home, status, alice)).to be false
end
it 'returns false for reblog from followee on non-exclusive antenna' do
list.exclusive = false
alice.follow!(jeff)
antenna.accounts << jeff
status = Fabricate(:status, text: 'I post a lot', account: bob)
reblog = Fabricate(:status, reblog: status, account: jeff)
expect(described_class.instance.filter?(:home, reblog, alice)).to be false
end
end
context 'with mentions feed' do