* Bump version to 8.0 * Add: 他のサーバーに公開する情報に、制限設定などを追加 * Fix: `quote_of_id`のインデックス * Fix: #172 他のサーバーからの相乗り絵文字削除が反映されない * Test: #166 リモートから自分の絵文字を受け取った時、ライセンスが上書きされないことを確認するテスト * Add: #62 ローカルタイムラインを無効にする管理者設定(内部挙動のみ) * Add: 画面部分を追加
This commit is contained in:
parent
ae865975d4
commit
1d8862712a
21 changed files with 238 additions and 16 deletions
|
@ -130,6 +130,16 @@ RSpec.describe PublicFeed do
|
|||
it 'includes public_unlisted statuses' do
|
||||
expect(subject).to include(public_unlisted_status.id)
|
||||
end
|
||||
|
||||
context 'when local timeline is disabled' do
|
||||
before do
|
||||
Form::AdminSettings.new(enable_local_timeline: '0').save
|
||||
end
|
||||
|
||||
it 'does not include all statuses' do
|
||||
expect(subject).to eq []
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'with a viewer' do
|
||||
|
@ -150,6 +160,16 @@ RSpec.describe PublicFeed do
|
|||
expect(subject).to include(public_unlisted_status.id)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when local timeline is disabled' do
|
||||
before do
|
||||
Form::AdminSettings.new(enable_local_timeline: '0').save
|
||||
end
|
||||
|
||||
it 'does not include all statuses' do
|
||||
expect(subject).to eq []
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'with a remote_only option set' do
|
||||
|
|
|
@ -59,6 +59,12 @@ describe TagFeed, type: :service do
|
|||
expect(results).to_not include status_tagged_with_cats
|
||||
end
|
||||
|
||||
it 'can restrict to local but local timeline is disabled' do
|
||||
Form::AdminSettings.new(enable_local_timeline: '0').save
|
||||
results = described_class.new(tag_cats, nil, any: [tag_dogs.name], local: true).get(20)
|
||||
expect(results).to_not include status_tagged_with_cats
|
||||
end
|
||||
|
||||
it 'allows replies to be included' do
|
||||
original = Fabricate(:status)
|
||||
status = Fabricate(:status, tags: [tag_cats], in_reply_to_id: original.id)
|
||||
|
|
|
@ -7,9 +7,12 @@ describe 'Public' do
|
|||
let(:scopes) { 'read:statuses' }
|
||||
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: scopes) }
|
||||
let(:headers) { { 'Authorization' => "Bearer #{token.token}" } }
|
||||
let(:ltl_enabled) { true }
|
||||
|
||||
shared_examples 'a successful request to the public timeline' do
|
||||
it 'returns the expected statuses successfully', :aggregate_failures do
|
||||
Form::AdminSettings.new(enable_local_timeline: '0').save unless ltl_enabled
|
||||
|
||||
subject
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
|
@ -47,6 +50,13 @@ describe 'Public' do
|
|||
let(:expected_statuses) { [local_status, media_status] }
|
||||
|
||||
it_behaves_like 'a successful request to the public timeline'
|
||||
|
||||
context 'when local timeline is disabled' do
|
||||
let(:expected_statuses) { [] }
|
||||
let(:ltl_enabled) { false }
|
||||
|
||||
it_behaves_like 'a successful request to the public timeline'
|
||||
end
|
||||
end
|
||||
|
||||
context 'with remote param' do
|
||||
|
@ -54,6 +64,12 @@ describe 'Public' do
|
|||
let(:expected_statuses) { [remote_status] }
|
||||
|
||||
it_behaves_like 'a successful request to the public timeline'
|
||||
|
||||
context 'when local timeline is disabled' do
|
||||
let(:ltl_enabled) { false }
|
||||
|
||||
it_behaves_like 'a successful request to the public timeline'
|
||||
end
|
||||
end
|
||||
|
||||
context 'with local and remote params' do
|
||||
|
@ -61,6 +77,12 @@ describe 'Public' do
|
|||
let(:expected_statuses) { [local_status, remote_status, media_status] }
|
||||
|
||||
it_behaves_like 'a successful request to the public timeline'
|
||||
|
||||
context 'when local timeline is disabled' do
|
||||
let(:ltl_enabled) { false }
|
||||
|
||||
it_behaves_like 'a successful request to the public timeline'
|
||||
end
|
||||
end
|
||||
|
||||
context 'with only_media param' do
|
||||
|
|
|
@ -5,6 +5,8 @@ require 'rails_helper'
|
|||
RSpec.describe DeliveryAntennaService, type: :service do
|
||||
subject { described_class.new }
|
||||
|
||||
let(:ltl_enabled) { true }
|
||||
|
||||
let(:last_active_at) { Time.now.utc }
|
||||
let(:last_active_at_tom) { Time.now.utc }
|
||||
let(:visibility) { :public }
|
||||
|
@ -36,6 +38,8 @@ RSpec.describe DeliveryAntennaService, type: :service do
|
|||
bob.follow!(alice)
|
||||
alice.block!(ohagi)
|
||||
|
||||
Form::AdminSettings.new(enable_local_timeline: '0').save unless ltl_enabled
|
||||
|
||||
allow(redis).to receive(:publish)
|
||||
|
||||
subject.call(status, false, mode: mode)
|
||||
|
@ -124,6 +128,29 @@ RSpec.describe DeliveryAntennaService, type: :service do
|
|||
end
|
||||
end
|
||||
|
||||
context 'with local domain' do
|
||||
let(:domain) { nil }
|
||||
let!(:antenna) { antenna_with_domain(bob, 'cb6e6126.ngrok.io') }
|
||||
let!(:empty_antenna) { antenna_with_domain(tom, 'ohagi.example.com') }
|
||||
|
||||
it 'detecting antenna' do
|
||||
expect(antenna_feed_of(antenna)).to include status.id
|
||||
end
|
||||
|
||||
it 'not detecting antenna' do
|
||||
expect(antenna_feed_of(empty_antenna)).to_not include status.id
|
||||
end
|
||||
|
||||
context 'when local timeline is disabled' do
|
||||
let(:ltl_enabled) { false }
|
||||
|
||||
it 'not detecting antenna' do
|
||||
expect(antenna_feed_of(antenna)).to_not include status.id
|
||||
expect(antenna_feed_of(empty_antenna)).to_not include status.id
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'with tag' do
|
||||
let!(:antenna) { antenna_with_tag(bob, 'hoge') }
|
||||
let!(:empty_antenna) { antenna_with_tag(tom, 'hog') }
|
||||
|
|
|
@ -5,6 +5,8 @@ require 'rails_helper'
|
|||
RSpec.describe FanOutOnWriteService, type: :service do
|
||||
subject { described_class.new }
|
||||
|
||||
let(:ltl_enabled) { true }
|
||||
|
||||
let(:last_active_at) { Time.now.utc }
|
||||
let(:visibility) { 'public' }
|
||||
let(:searchability) { 'public' }
|
||||
|
@ -28,6 +30,8 @@ RSpec.describe FanOutOnWriteService, type: :service do
|
|||
tom.follow!(alice)
|
||||
ohagi.follow!(bob)
|
||||
|
||||
Form::AdminSettings.new(enable_local_timeline: '0').save unless ltl_enabled
|
||||
|
||||
ProcessMentionsService.new.call(status)
|
||||
ProcessHashtagsService.new.call(status)
|
||||
|
||||
|
@ -86,6 +90,20 @@ RSpec.describe FanOutOnWriteService, type: :service do
|
|||
expect(redis).to have_received(:publish).with('timeline:public:local', anything)
|
||||
end
|
||||
|
||||
context 'when local timeline is disabled' do
|
||||
let(:ltl_enabled) { false }
|
||||
|
||||
it 'is broadcast to the hashtag stream' do
|
||||
expect(redis).to have_received(:publish).with('timeline:hashtag:hoge', anything)
|
||||
expect(redis).to_not have_received(:publish).with('timeline:hashtag:hoge:local', anything)
|
||||
end
|
||||
|
||||
it 'is broadcast to the public stream' do
|
||||
expect(redis).to have_received(:publish).with('timeline:public', anything)
|
||||
expect(redis).to_not have_received(:publish).with('timeline:public:local', anything)
|
||||
end
|
||||
end
|
||||
|
||||
context 'with list' do
|
||||
let!(:list) { list_with_account(bob, alice) }
|
||||
let!(:empty_list) { Fabricate(:list, account: tom) }
|
||||
|
@ -130,6 +148,15 @@ RSpec.describe FanOutOnWriteService, type: :service do
|
|||
expect(antenna_feed_of(antenna)).to include status.id
|
||||
end
|
||||
end
|
||||
|
||||
context 'when local timeline is disabled' do
|
||||
let(:ltl_enabled) { false }
|
||||
|
||||
it 'is not added to the antenna feed of antenna follower' do
|
||||
expect(antenna_feed_of(antenna)).to_not include status.id
|
||||
expect(antenna_feed_of(empty_antenna)).to_not include status.id
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'with LTL antenna' do
|
||||
|
@ -148,6 +175,15 @@ RSpec.describe FanOutOnWriteService, type: :service do
|
|||
expect(antenna_feed_of(antenna)).to include status.id
|
||||
end
|
||||
end
|
||||
|
||||
context 'when local timeline is disabled' do
|
||||
let(:ltl_enabled) { false }
|
||||
|
||||
it 'is not added to the antenna feed of antenna follower' do
|
||||
expect(antenna_feed_of(antenna)).to_not include status.id
|
||||
expect(antenna_feed_of(empty_antenna)).to_not include status.id
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -255,6 +291,15 @@ RSpec.describe FanOutOnWriteService, type: :service do
|
|||
expect(antenna_feed_of(antenna)).to include status.id
|
||||
expect(antenna_feed_of(empty_antenna)).to_not include status.id
|
||||
end
|
||||
|
||||
context 'when local timeline is disabled' do
|
||||
let(:ltl_enabled) { false }
|
||||
|
||||
it 'is not added to the antenna feed of antenna follower' do
|
||||
expect(antenna_feed_of(antenna)).to_not include status.id
|
||||
expect(antenna_feed_of(empty_antenna)).to_not include status.id
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'with LTL antenna' do
|
||||
|
@ -263,6 +308,14 @@ RSpec.describe FanOutOnWriteService, type: :service do
|
|||
it 'is added to the antenna feed of antenna follower' do
|
||||
expect(antenna_feed_of(empty_antenna)).to_not include status.id
|
||||
end
|
||||
|
||||
context 'when local timeline is disabled' do
|
||||
let(:ltl_enabled) { false }
|
||||
|
||||
it 'is not added to the antenna feed of antenna follower' do
|
||||
expect(antenna_feed_of(empty_antenna)).to_not include status.id
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -284,6 +337,20 @@ RSpec.describe FanOutOnWriteService, type: :service do
|
|||
expect(redis).to have_received(:publish).with('timeline:public', anything)
|
||||
end
|
||||
|
||||
context 'when local timeline is disabled' do
|
||||
let(:ltl_enabled) { false }
|
||||
|
||||
it 'is broadcast to the hashtag stream' do
|
||||
expect(redis).to have_received(:publish).with('timeline:hashtag:hoge', anything)
|
||||
expect(redis).to_not have_received(:publish).with('timeline:hashtag:hoge:local', anything)
|
||||
end
|
||||
|
||||
it 'is broadcast to the public stream' do
|
||||
expect(redis).to have_received(:publish).with('timeline:public', anything)
|
||||
expect(redis).to_not have_received(:publish).with('timeline:public:local', anything)
|
||||
end
|
||||
end
|
||||
|
||||
context 'with list' do
|
||||
let!(:list) { list_with_account(bob, alice) }
|
||||
let!(:empty_list) { list_with_account(ohagi, bob) }
|
||||
|
@ -328,6 +395,15 @@ RSpec.describe FanOutOnWriteService, type: :service do
|
|||
expect(antenna_feed_of(antenna)).to include status.id
|
||||
end
|
||||
end
|
||||
|
||||
context 'when local timeline is disabled' do
|
||||
let(:ltl_enabled) { false }
|
||||
|
||||
it 'is not added to the antenna feed of antenna follower' do
|
||||
expect(antenna_feed_of(antenna)).to_not include status.id
|
||||
expect(antenna_feed_of(empty_antenna)).to_not include status.id
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'with LTL antenna' do
|
||||
|
@ -346,6 +422,15 @@ RSpec.describe FanOutOnWriteService, type: :service do
|
|||
expect(antenna_feed_of(antenna)).to include status.id
|
||||
end
|
||||
end
|
||||
|
||||
context 'when local timeline is disabled' do
|
||||
let(:ltl_enabled) { false }
|
||||
|
||||
it 'is not added to the antenna feed of antenna follower' do
|
||||
expect(antenna_feed_of(antenna)).to_not include status.id
|
||||
expect(antenna_feed_of(empty_antenna)).to_not include status.id
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -384,6 +469,15 @@ RSpec.describe FanOutOnWriteService, type: :service do
|
|||
end
|
||||
end
|
||||
|
||||
context 'when local timeline is disabled' do
|
||||
let(:ltl_enabled) { false }
|
||||
|
||||
it 'is broadcast to the hashtag stream' do
|
||||
expect(redis).to have_received(:publish).with('timeline:hashtag:hoge', anything)
|
||||
expect(redis).to_not have_received(:publish).with('timeline:hashtag:hoge:local', anything)
|
||||
end
|
||||
end
|
||||
|
||||
context 'with list' do
|
||||
let!(:list) { list_with_account(bob, alice) }
|
||||
let!(:empty_list) { list_with_account(ohagi, bob) }
|
||||
|
@ -412,6 +506,15 @@ RSpec.describe FanOutOnWriteService, type: :service do
|
|||
expect(antenna_feed_of(antenna)).to include status.id
|
||||
expect(antenna_feed_of(empty_antenna)).to_not include status.id
|
||||
end
|
||||
|
||||
context 'when local timeline is disabled' do
|
||||
let(:ltl_enabled) { false }
|
||||
|
||||
it 'is not added to the antenna feed of antenna follower' do
|
||||
expect(antenna_feed_of(antenna)).to_not include status.id
|
||||
expect(antenna_feed_of(empty_antenna)).to_not include status.id
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'with LTL antenna' do
|
||||
|
@ -420,6 +523,14 @@ RSpec.describe FanOutOnWriteService, type: :service do
|
|||
it 'is added to the antenna feed of antenna follower' do
|
||||
expect(antenna_feed_of(empty_antenna)).to_not include status.id
|
||||
end
|
||||
|
||||
context 'when local timeline is disabled' do
|
||||
let(:ltl_enabled) { false }
|
||||
|
||||
it 'is not added to the antenna feed of antenna follower' do
|
||||
expect(antenna_feed_of(empty_antenna)).to_not include status.id
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'with non-public searchability' do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue