about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-11-26 15:32:29 +0100
committerEugen Rochko <eugen@zeonfederated.com>2016-11-26 15:32:29 +0100
commit054138797f6f8a9d58ba14c806e8efeed8083abb (patch)
tree9a4da6da14cf4c93f015c94ef4abce05891a16fc /app
parent6c82dfcf5fd51e652490b927fbf5773c3f52e803 (diff)
Fix #288 - Strip first @ from search query, don't search accounts if it begins with #
Diffstat (limited to 'app')
-rw-r--r--app/services/search_service.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/app/services/search_service.rb b/app/services/search_service.rb
index 598c7d02c..1ae1d5a80 100644
--- a/app/services/search_service.rb
+++ b/app/services/search_service.rb
@@ -2,9 +2,9 @@
 
 class SearchService < BaseService
   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?
                 Account.search_for(username)