|
|
|
|
@ -202,5 +202,320 @@ RSpec.describe PublicFeed do
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
context 'when both local_live_feed_access and remote_live_feed_access are disabled' do
|
|
|
|
|
before do
|
|
|
|
|
Setting.local_live_feed_access = 'disabled'
|
|
|
|
|
Setting.remote_live_feed_access = 'disabled'
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
context 'without local_only option' do
|
|
|
|
|
subject { described_class.new(viewer).get(20).map(&:id) }
|
|
|
|
|
|
|
|
|
|
let(:viewer) { nil }
|
|
|
|
|
|
|
|
|
|
let!(:local_account) { Fabricate(:account, domain: nil) }
|
|
|
|
|
let!(:remote_account) { Fabricate(:account, domain: 'test.com') }
|
|
|
|
|
let!(:local_status) { Fabricate(:status, account: local_account) }
|
|
|
|
|
let!(:remote_status) { Fabricate(:status, account: remote_account) }
|
|
|
|
|
|
|
|
|
|
context 'without a viewer' do
|
|
|
|
|
let(:viewer) { nil }
|
|
|
|
|
|
|
|
|
|
it 'returns an empty list' do
|
|
|
|
|
expect(subject).to be_empty
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
context 'with a viewer' do
|
|
|
|
|
let(:viewer) { Fabricate(:account, username: 'viewer') }
|
|
|
|
|
|
|
|
|
|
it 'returns an empty list' do
|
|
|
|
|
expect(subject).to be_empty
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
context 'with a moderator as viewer' do
|
|
|
|
|
let(:viewer) { Fabricate(:moderator_user).account }
|
|
|
|
|
|
|
|
|
|
it 'includes all expected statuses' do
|
|
|
|
|
expect(subject).to include(local_status.id)
|
|
|
|
|
expect(subject).to include(remote_status.id)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
context 'with a local_only option set' do
|
|
|
|
|
subject { described_class.new(viewer, local: true).get(20).map(&:id) }
|
|
|
|
|
|
|
|
|
|
let!(:local_account) { Fabricate(:account, domain: nil) }
|
|
|
|
|
let!(:remote_account) { Fabricate(:account, domain: 'test.com') }
|
|
|
|
|
let!(:local_status) { Fabricate(:status, account: local_account) }
|
|
|
|
|
let!(:remote_status) { Fabricate(:status, account: remote_account) }
|
|
|
|
|
|
|
|
|
|
context 'without a viewer' do
|
|
|
|
|
let(:viewer) { nil }
|
|
|
|
|
|
|
|
|
|
it 'returns an empty list' do
|
|
|
|
|
expect(subject).to be_empty
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
context 'with a viewer' do
|
|
|
|
|
let(:viewer) { Fabricate(:account, username: 'viewer') }
|
|
|
|
|
|
|
|
|
|
it 'returns an empty list' do
|
|
|
|
|
expect(subject).to be_empty
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
context 'with a moderator as viewer' do
|
|
|
|
|
let(:viewer) { Fabricate(:moderator_user).account }
|
|
|
|
|
|
|
|
|
|
it 'does not include remote instances statuses' do
|
|
|
|
|
expect(subject).to include(local_status.id)
|
|
|
|
|
expect(subject).to_not include(remote_status.id)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
context 'with a remote_only option set' do
|
|
|
|
|
subject { described_class.new(viewer, remote: true).get(20).map(&:id) }
|
|
|
|
|
|
|
|
|
|
let!(:local_account) { Fabricate(:account, domain: nil) }
|
|
|
|
|
let!(:remote_account) { Fabricate(:account, domain: 'test.com') }
|
|
|
|
|
let!(:local_status) { Fabricate(:status, account: local_account) }
|
|
|
|
|
let!(:remote_status) { Fabricate(:status, account: remote_account) }
|
|
|
|
|
|
|
|
|
|
context 'without a viewer' do
|
|
|
|
|
let(:viewer) { nil }
|
|
|
|
|
|
|
|
|
|
it 'returns an empty list' do
|
|
|
|
|
expect(subject).to be_empty
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
context 'with a viewer' do
|
|
|
|
|
let(:viewer) { Fabricate(:account, username: 'viewer') }
|
|
|
|
|
|
|
|
|
|
it 'returns an empty list' do
|
|
|
|
|
expect(subject).to be_empty
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
context 'with a moderator as viewer' do
|
|
|
|
|
let(:viewer) { Fabricate(:moderator_user).account }
|
|
|
|
|
|
|
|
|
|
it 'includes remote statuses only' do
|
|
|
|
|
expect(subject).to_not include(local_status.id)
|
|
|
|
|
expect(subject).to include(remote_status.id)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
context 'when local_live_feed_access is disabled' do
|
|
|
|
|
before do
|
|
|
|
|
Setting.local_live_feed_access = 'disabled'
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
context 'without local_only option' do
|
|
|
|
|
subject { described_class.new(viewer).get(20).map(&:id) }
|
|
|
|
|
|
|
|
|
|
let(:viewer) { nil }
|
|
|
|
|
|
|
|
|
|
let!(:local_account) { Fabricate(:account, domain: nil) }
|
|
|
|
|
let!(:remote_account) { Fabricate(:account, domain: 'test.com') }
|
|
|
|
|
let!(:local_status) { Fabricate(:status, account: local_account) }
|
|
|
|
|
let!(:remote_status) { Fabricate(:status, account: remote_account) }
|
|
|
|
|
|
|
|
|
|
context 'without a viewer' do
|
|
|
|
|
let(:viewer) { nil }
|
|
|
|
|
|
|
|
|
|
it 'does not include local instances statuses' do
|
|
|
|
|
expect(subject).to_not include(local_status.id)
|
|
|
|
|
expect(subject).to include(remote_status.id)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
context 'with a viewer' do
|
|
|
|
|
let(:viewer) { Fabricate(:account, username: 'viewer') }
|
|
|
|
|
|
|
|
|
|
it 'does not include local instances statuses' do
|
|
|
|
|
expect(subject).to_not include(local_status.id)
|
|
|
|
|
expect(subject).to include(remote_status.id)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
context 'with a local_only option set' do
|
|
|
|
|
subject { described_class.new(viewer, local: true).get(20).map(&:id) }
|
|
|
|
|
|
|
|
|
|
let!(:local_account) { Fabricate(:account, domain: nil) }
|
|
|
|
|
let!(:remote_account) { Fabricate(:account, domain: 'test.com') }
|
|
|
|
|
let!(:local_status) { Fabricate(:status, account: local_account) }
|
|
|
|
|
let!(:remote_status) { Fabricate(:status, account: remote_account) }
|
|
|
|
|
|
|
|
|
|
context 'without a viewer' do
|
|
|
|
|
let(:viewer) { nil }
|
|
|
|
|
|
|
|
|
|
it 'returns an empty list' do
|
|
|
|
|
expect(subject).to be_empty
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
context 'with a viewer' do
|
|
|
|
|
let(:viewer) { Fabricate(:account, username: 'viewer') }
|
|
|
|
|
|
|
|
|
|
it 'returns an empty list' do
|
|
|
|
|
expect(subject).to be_empty
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
context 'with a moderator as viewer' do
|
|
|
|
|
let(:viewer) { Fabricate(:moderator_user).account }
|
|
|
|
|
|
|
|
|
|
it 'does not include remote instances statuses' do
|
|
|
|
|
expect(subject).to include(local_status.id)
|
|
|
|
|
expect(subject).to_not include(remote_status.id)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
context 'with a remote_only option set' do
|
|
|
|
|
subject { described_class.new(viewer, remote: true).get(20).map(&:id) }
|
|
|
|
|
|
|
|
|
|
let!(:local_account) { Fabricate(:account, domain: nil) }
|
|
|
|
|
let!(:remote_account) { Fabricate(:account, domain: 'test.com') }
|
|
|
|
|
let!(:local_status) { Fabricate(:status, account: local_account) }
|
|
|
|
|
let!(:remote_status) { Fabricate(:status, account: remote_account) }
|
|
|
|
|
|
|
|
|
|
context 'without a viewer' do
|
|
|
|
|
let(:viewer) { nil }
|
|
|
|
|
|
|
|
|
|
it 'does not include local instances statuses' do
|
|
|
|
|
expect(subject).to_not include(local_status.id)
|
|
|
|
|
expect(subject).to include(remote_status.id)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
context 'with a viewer' do
|
|
|
|
|
let(:viewer) { Fabricate(:account, username: 'viewer') }
|
|
|
|
|
|
|
|
|
|
it 'does not include local instances statuses' do
|
|
|
|
|
expect(subject).to_not include(local_status.id)
|
|
|
|
|
expect(subject).to include(remote_status.id)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
context 'when remote_live_feed_access is disabled' do
|
|
|
|
|
before do
|
|
|
|
|
Setting.remote_live_feed_access = 'disabled'
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
context 'without local_only option' do
|
|
|
|
|
subject { described_class.new(viewer).get(20).map(&:id) }
|
|
|
|
|
|
|
|
|
|
let(:viewer) { nil }
|
|
|
|
|
|
|
|
|
|
let!(:local_account) { Fabricate(:account, domain: nil) }
|
|
|
|
|
let!(:remote_account) { Fabricate(:account, domain: 'test.com') }
|
|
|
|
|
let!(:local_status) { Fabricate(:status, account: local_account) }
|
|
|
|
|
let!(:remote_status) { Fabricate(:status, account: remote_account) }
|
|
|
|
|
|
|
|
|
|
context 'without a viewer' do
|
|
|
|
|
let(:viewer) { nil }
|
|
|
|
|
|
|
|
|
|
it 'does not include remote instances statuses' do
|
|
|
|
|
expect(subject).to include(local_status.id)
|
|
|
|
|
expect(subject).to_not include(remote_status.id)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
context 'with a viewer' do
|
|
|
|
|
let(:viewer) { Fabricate(:account, username: 'viewer') }
|
|
|
|
|
|
|
|
|
|
it 'does not include remote instances statuses' do
|
|
|
|
|
expect(subject).to include(local_status.id)
|
|
|
|
|
expect(subject).to_not include(remote_status.id)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
it 'is not affected by personal domain blocks' do
|
|
|
|
|
viewer.block_domain!('test.com')
|
|
|
|
|
expect(subject).to include(local_status.id)
|
|
|
|
|
expect(subject).to_not include(remote_status.id)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
context 'with a local_only option set' do
|
|
|
|
|
subject { described_class.new(viewer, local: true).get(20).map(&:id) }
|
|
|
|
|
|
|
|
|
|
let!(:local_account) { Fabricate(:account, domain: nil) }
|
|
|
|
|
let!(:remote_account) { Fabricate(:account, domain: 'test.com') }
|
|
|
|
|
let!(:local_status) { Fabricate(:status, account: local_account) }
|
|
|
|
|
let!(:remote_status) { Fabricate(:status, account: remote_account) }
|
|
|
|
|
|
|
|
|
|
context 'without a viewer' do
|
|
|
|
|
let(:viewer) { nil }
|
|
|
|
|
|
|
|
|
|
it 'does not include remote instances statuses' do
|
|
|
|
|
expect(subject).to include(local_status.id)
|
|
|
|
|
expect(subject).to_not include(remote_status.id)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
context 'with a viewer' do
|
|
|
|
|
let(:viewer) { Fabricate(:account, username: 'viewer') }
|
|
|
|
|
|
|
|
|
|
it 'does not include remote instances statuses' do
|
|
|
|
|
expect(subject).to include(local_status.id)
|
|
|
|
|
expect(subject).to_not include(remote_status.id)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
it 'is not affected by personal domain blocks' do
|
|
|
|
|
viewer.block_domain!('test.com')
|
|
|
|
|
expect(subject).to include(local_status.id)
|
|
|
|
|
expect(subject).to_not include(remote_status.id)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
context 'with a remote_only option set' do
|
|
|
|
|
subject { described_class.new(viewer, remote: true).get(20).map(&:id) }
|
|
|
|
|
|
|
|
|
|
let!(:local_account) { Fabricate(:account, domain: nil) }
|
|
|
|
|
let!(:remote_account) { Fabricate(:account, domain: 'test.com') }
|
|
|
|
|
let!(:local_status) { Fabricate(:status, account: local_account) }
|
|
|
|
|
let!(:remote_status) { Fabricate(:status, account: remote_account) }
|
|
|
|
|
|
|
|
|
|
context 'without a viewer' do
|
|
|
|
|
let(:viewer) { nil }
|
|
|
|
|
|
|
|
|
|
it 'returns an empty list' do
|
|
|
|
|
expect(subject).to be_empty
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
context 'with a viewer' do
|
|
|
|
|
let(:viewer) { Fabricate(:account, username: 'viewer') }
|
|
|
|
|
|
|
|
|
|
it 'returns an empty list' do
|
|
|
|
|
expect(subject).to be_empty
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
context 'with a moderator as viewer' do
|
|
|
|
|
let(:viewer) { Fabricate(:moderator_user).account }
|
|
|
|
|
|
|
|
|
|
it 'does not include local instances statuses' do
|
|
|
|
|
expect(subject).to_not include(local_status.id)
|
|
|
|
|
expect(subject).to include(remote_status.id)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|