Fix #288 - Strip first @ from search query, don't search accounts if it begins with #

lolsob-rspec
Eugen Rochko 2016-11-26 15:32:29 +01:00
parent 8b32b212de
commit 1f62ffcc7a
1 changed files with 2 additions and 2 deletions

View File

@ -2,9 +2,9 @@
class SearchService < BaseService class SearchService < BaseService
def call(query, limit, resolve = false) def call(query, limit, resolve = false)
return if query.blank? return if query.blank? || query.start_with?('#')
username, domain = query.split('@') username, domain = query.gsub(/\A@/, '').split('@')
results = if domain.nil? results = if domain.nil?
Account.search_for(username) Account.search_for(username)