]> cat aescling's git repositories - mastodon.git/commitdiff
Search only from followees (#5897)
authorYamagishi Kazutoshi <ykzts@desire.sh>
Wed, 6 Dec 2017 10:44:23 +0000 (19:44 +0900)
committerEugen Rochko <eugen@zeonfederated.com>
Wed, 6 Dec 2017 10:44:23 +0000 (11:44 +0100)
app/services/account_search_service.rb

index ce25c3620f0c824eacccd031b9c7504709a9e733..a289ceac4fcd322d2ffde10b096569b16765bae7 100644 (file)
@@ -58,12 +58,16 @@ class AccountSearchService < BaseService
     @_domain_is_local ||= TagManager.instance.local_domain?(query_domain)
   end
 
+  def search_from
+    options[:following] && account ? account.following : Account
+  end
+
   def exact_match
     @_exact_match ||= begin
       if domain_is_local?
-        Account.find_local(query_username)
+        search_from.find_local(query_username)
       else
-        Account.find_remote(query_username, query_domain)
+        search_from.find_remote(query_username, query_domain)
       end
     end
   end