Merge remote-tracking branch 'parent/main' into upstream-20240117

This commit is contained in:
KMY 2025-01-17 16:29:11 +09:00
commit 5d79bd078c
150 changed files with 2982 additions and 1485 deletions

View file

@ -9,6 +9,8 @@ RSpec.describe Status do
let(:bob) { Fabricate(:account, username: 'bob') }
let(:other) { Fabricate(:status, account: bob, text: 'Skulls for the skull god! The enemy\'s gates are sideways!') }
include_examples 'Status::Visibility'
describe '#local?' do
it 'returns true when no remote URI is set' do
expect(subject.local?).to be true
@ -84,178 +86,6 @@ RSpec.describe Status do
end
end
describe '#hidden?' do
context 'when private_visibility?' do
it 'returns true' do
subject.visibility = :private
expect(subject.hidden?).to be true
end
end
context 'when direct_visibility?' do
it 'returns true' do
subject.visibility = :direct
expect(subject.hidden?).to be true
end
end
context 'when public_visibility?' do
it 'returns false' do
subject.visibility = :public
expect(subject.hidden?).to be false
end
end
context 'when unlisted_visibility?' do
it 'returns false' do
subject.visibility = :unlisted
expect(subject.hidden?).to be false
end
end
end
describe '#compute_searchability' do
subject { Fabricate(:status, account: account, searchability: status_searchability) }
let(:account_searchability) { :public }
let(:status_searchability) { :public }
let(:account_domain) { 'example.com' }
let(:silenced_at) { nil }
let(:account) { Fabricate(:account, domain: account_domain, searchability: account_searchability, silenced_at: silenced_at) }
context 'when public-public' do
it 'returns public' do
expect(subject.compute_searchability).to eq 'public'
end
end
context 'when public-public but silenced' do
let(:silenced_at) { Time.now.utc }
it 'returns private' do
expect(subject.compute_searchability).to eq 'private'
end
end
context 'when public-public_unlisted but silenced' do
let(:silenced_at) { Time.now.utc }
let(:status_searchability) { :public_unlisted }
it 'returns private' do
expect(subject.compute_searchability).to eq 'private'
end
end
context 'when public-public_unlisted' do
let(:status_searchability) { :public_unlisted }
it 'returns public' do
expect(subject.compute_searchability).to eq 'public'
end
it 'returns public_unlisted for local' do
expect(subject.compute_searchability_local).to eq 'public_unlisted'
end
end
context 'when public-private' do
let(:status_searchability) { :private }
it 'returns private' do
expect(subject.compute_searchability).to eq 'private'
end
end
context 'when public-direct' do
let(:status_searchability) { :direct }
it 'returns direct' do
expect(subject.compute_searchability).to eq 'direct'
end
end
context 'when private-public' do
let(:account_searchability) { :private }
it 'returns private' do
expect(subject.compute_searchability).to eq 'private'
end
end
context 'when direct-public' do
let(:account_searchability) { :direct }
it 'returns direct' do
expect(subject.compute_searchability).to eq 'direct'
end
end
context 'when limited-public' do
let(:account_searchability) { :limited }
it 'returns limited' do
expect(subject.compute_searchability).to eq 'limited'
end
end
context 'when private-limited' do
let(:account_searchability) { :private }
let(:status_searchability) { :limited }
it 'returns limited' do
expect(subject.compute_searchability).to eq 'limited'
end
end
context 'when private-public of local account' do
let(:account_searchability) { :private }
let(:account_domain) { nil }
let(:status_searchability) { :public }
it 'returns public' do
expect(subject.compute_searchability).to eq 'public'
end
end
context 'when direct-public of local account' do
let(:account_searchability) { :direct }
let(:account_domain) { nil }
let(:status_searchability) { :public }
it 'returns public' do
expect(subject.compute_searchability).to eq 'public'
end
end
context 'when limited-public of local account' do
let(:account_searchability) { :limited }
let(:account_domain) { nil }
let(:status_searchability) { :public }
it 'returns public' do
expect(subject.compute_searchability).to eq 'public'
end
end
context 'when public-public_unlisted of local account' do
let(:account_searchability) { :public }
let(:account_domain) { nil }
let(:status_searchability) { :public_unlisted }
it 'returns public' do
expect(subject.compute_searchability).to eq 'public'
end
it 'returns public_unlisted for local' do
expect(subject.compute_searchability_local).to eq 'public_unlisted'
end
it 'returns private for activitypub' do
expect(subject.compute_searchability_activitypub).to eq 'private'
end
end
end
describe '#quote' do
let(:target_status) { Fabricate(:status) }
let(:quote) { true }