]> cat aescling's git repositories - mastodon.git/commitdiff
Fix account search with no query (#12549)
authortrwnh <a@trwnh.com>
Fri, 6 Dec 2019 18:44:23 +0000 (12:44 -0600)
committerEugen Rochko <eugen@zeonfederated.com>
Fri, 6 Dec 2019 18:44:23 +0000 (19:44 +0100)
* Fix account search with no query

Modeled after #12541. Fix #12548

* fix codeclimate

app/services/account_search_service.rb

index 7e74cc893992d10cf71752b455679fa35d81517e..d217dabb37f4857a692e4cb6c277091ba2b47ec8 100644 (file)
@@ -4,8 +4,8 @@ class AccountSearchService < BaseService
   attr_reader :query, :limit, :offset, :options, :account
 
   def call(query, account = nil, options = {})
-    @acct_hint = query.start_with?('@')
-    @query     = query.strip.gsub(/\A@/, '')
+    @acct_hint = query&.start_with?('@')
+    @query     = query&.strip&.gsub(/\A@/, '')
     @limit     = options[:limit].to_i
     @offset    = options[:offset].to_i
     @options   = options