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

This commit is contained in:
KMY 2023-11-24 09:07:40 +09:00
commit c5e4020922
206 changed files with 1987 additions and 965 deletions

View file

@ -651,10 +651,11 @@ RSpec.describe Account do
expect(results).to eq [match]
end
it 'limits by 10 by default' do
11.times.each { Fabricate(:account, display_name: 'Display Name') }
it 'limits via constant by default' do
stub_const('AccountSearch::DEFAULT_LIMIT', 1)
2.times.each { Fabricate(:account, display_name: 'Display Name') }
results = described_class.search_for('display')
expect(results.size).to eq 10
expect(results.size).to eq 1
end
it 'accepts arbitrary limits' do
@ -743,6 +744,33 @@ RSpec.describe Account do
end
end
context 'when limiting search to follower accounts' do
it 'accepts ?, \, : and space as delimiter' do
match = Fabricate(
:account,
display_name: 'A & l & i & c & e',
username: 'username',
domain: 'example.com'
)
match.follow!(account)
results = described_class.advanced_search_for('A?l\i:c e', account, limit: 10, follower: true)
expect(results).to eq [match]
end
it 'does not return non-follower accounts' do
Fabricate(
:account,
display_name: 'A & l & i & c & e',
username: 'username',
domain: 'example.com'
)
results = described_class.advanced_search_for('A?l\i:c e', account, limit: 10, follower: true)
expect(results).to eq []
end
end
it 'does not return suspended users' do
Fabricate(
:account,
@ -795,9 +823,10 @@ RSpec.describe Account do
end
it 'limits by 10 by default' do
11.times { Fabricate(:account, display_name: 'Display Name') }
stub_const('AccountSearch::DEFAULT_LIMIT', 1)
2.times { Fabricate(:account, display_name: 'Display Name') }
results = described_class.advanced_search_for('display', account)
expect(results.size).to eq 10
expect(results.size).to eq 1
end
it 'accepts arbitrary limits' do