Merge remote-tracking branch 'parent/main' into upstream-20231021
This commit is contained in:
commit
f9eaaec4e7
95 changed files with 1002 additions and 657 deletions
|
@ -56,7 +56,7 @@ describe AccountSearchService, type: :service do
|
|||
service = instance_double(ResolveAccountService, call: nil)
|
||||
allow(ResolveAccountService).to receive(:new).and_return(service)
|
||||
|
||||
results = subject.call('newuser@remote.com', nil, limit: 10, resolve: true)
|
||||
subject.call('newuser@remote.com', nil, limit: 10, resolve: true)
|
||||
expect(service).to have_received(:call).with('newuser@remote.com')
|
||||
end
|
||||
|
||||
|
@ -64,14 +64,14 @@ describe AccountSearchService, type: :service do
|
|||
service = instance_double(ResolveAccountService, call: nil)
|
||||
allow(ResolveAccountService).to receive(:new).and_return(service)
|
||||
|
||||
results = subject.call('newuser@remote.com', nil, limit: 10, resolve: false)
|
||||
subject.call('newuser@remote.com', nil, limit: 10, resolve: false)
|
||||
expect(service).to_not have_received(:call)
|
||||
end
|
||||
end
|
||||
|
||||
it 'returns the fuzzy match first, and does not return suspended exacts' do
|
||||
partial = Fabricate(:account, username: 'exactness')
|
||||
exact = Fabricate(:account, username: 'exact', suspended: true)
|
||||
Fabricate(:account, username: 'exact', suspended: true)
|
||||
results = subject.call('exact', nil, limit: 10)
|
||||
|
||||
expect(results.size).to eq 1
|
||||
|
@ -79,7 +79,7 @@ describe AccountSearchService, type: :service do
|
|||
end
|
||||
|
||||
it 'does not return suspended remote accounts' do
|
||||
remote = Fabricate(:account, username: 'a', domain: 'remote', display_name: 'e', suspended: true)
|
||||
Fabricate(:account, username: 'a', domain: 'remote', display_name: 'e', suspended: true)
|
||||
results = subject.call('a@example.com', nil, limit: 2)
|
||||
|
||||
expect(results.size).to eq 0
|
||||
|
|
|
@ -307,7 +307,7 @@ RSpec.describe PostStatusService, type: :service do
|
|||
|
||||
it 'processes duplicate mentions correctly' do
|
||||
account = Fabricate(:account)
|
||||
mentioned_account = Fabricate(:account, username: 'alice')
|
||||
Fabricate(:account, username: 'alice')
|
||||
|
||||
expect do
|
||||
subject.call(account, text: '@alice @alice @alice hey @alice')
|
||||
|
@ -377,7 +377,7 @@ RSpec.describe PostStatusService, type: :service do
|
|||
account = Fabricate(:account)
|
||||
media = Fabricate(:media_attachment, account: Fabricate(:account))
|
||||
|
||||
status = subject.call(
|
||||
subject.call(
|
||||
account,
|
||||
text: 'test status update',
|
||||
media_ids: [media.id]
|
||||
|
@ -458,7 +458,7 @@ RSpec.describe PostStatusService, type: :service do
|
|||
|
||||
it 'hit ng words for mention' do
|
||||
account = Fabricate(:account)
|
||||
mentioned = Fabricate(:account, username: 'ohagi', domain: nil)
|
||||
Fabricate(:account, username: 'ohagi', domain: nil)
|
||||
text = 'ng word test @ohagi'
|
||||
Form::AdminSettings.new(ng_words_for_stranger_mention: 'test', stranger_mention_from_local_ng: '1').save
|
||||
|
||||
|
@ -467,7 +467,7 @@ RSpec.describe PostStatusService, type: :service do
|
|||
|
||||
it 'hit ng words for mention but local posts are not checked' do
|
||||
account = Fabricate(:account)
|
||||
mentioned = Fabricate(:account, username: 'ohagi', domain: nil)
|
||||
Fabricate(:account, username: 'ohagi', domain: nil)
|
||||
text = 'ng word test @ohagi'
|
||||
Form::AdminSettings.new(ng_words_for_stranger_mention: 'test', stranger_mention_from_local_ng: '0').save
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ RSpec.describe PrecomputeFeedService, type: :service do
|
|||
muted_account = Fabricate(:account)
|
||||
Fabricate(:mute, account: account, target_account: muted_account)
|
||||
reblog = Fabricate(:status, account: muted_account)
|
||||
status = Fabricate(:status, account: account, reblog: reblog)
|
||||
Fabricate(:status, account: account, reblog: reblog)
|
||||
|
||||
subject.call(account)
|
||||
|
||||
|
|
|
@ -7,8 +7,8 @@ describe ResolveURLService, type: :service do
|
|||
|
||||
describe '#call' do
|
||||
it 'returns nil when there is no resource url' do
|
||||
url = 'http://example.com/missing-resource'
|
||||
known_account = Fabricate(:account, uri: url, domain: 'example.com')
|
||||
url = 'http://example.com/missing-resource'
|
||||
Fabricate(:account, uri: url, domain: 'example.com')
|
||||
service = instance_double(FetchResourceService)
|
||||
|
||||
allow(FetchResourceService).to receive(:new).and_return service
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue