Browse Source

Fix nil query_username (#2013)

closed-social-glitch-2
Tomohiro Suwa 7 years ago
committed by Eugen
parent
commit
3399dd7a66
2 changed files with 13 additions and 1 deletions
  1. +1
    -1
      app/services/account_search_service.rb
  2. +12
    -0
      spec/services/account_search_service_spec.rb

+ 1
- 1
app/services/account_search_service.rb View File

@ -41,7 +41,7 @@ class AccountSearchService < BaseService
end
def query_username
@_query_username ||= split_query_string.first
@_query_username ||= split_query_string.first || ''
end
def query_domain

+ 12
- 0
spec/services/account_search_service_spec.rb View File

@ -25,6 +25,18 @@ describe AccountSearchService do
end
describe 'searching local and remote users' do
describe "when only '@'" do
before do
allow(Account).to receive(:find_remote)
allow(Account).to receive(:search_for)
subject.call('@', 10)
end
it 'uses find_remote with empty query to look for local accounts' do
expect(Account).to have_received(:find_remote).with('', nil)
end
end
describe 'when no domain' do
before do
allow(Account).to receive(:find_remote)

Loading…
Cancel
Save