]> cat aescling's git repositories - mastodon.git/commitdiff
Fix following restriction not working when exact match in account search (#14394)
authorTakeshi Umeda <noel.yoshiba@gmail.com>
Sun, 26 Jul 2020 21:58:36 +0000 (06:58 +0900)
committerGitHub <noreply@github.com>
Sun, 26 Jul 2020 21:58:36 +0000 (23:58 +0200)
app/services/account_search_service.rb

index 493813aab4e1c6b465da3a344a6fd17aee169636..43e59604055342a684d908b3810dd229a912a99c 100644 (file)
@@ -27,7 +27,7 @@ class AccountSearchService < BaseService
 
     return @exact_match if defined?(@exact_match)
 
-    @exact_match = begin
+    match = begin
       if options[:resolve]
         ResolveAccountService.new.call(query)
       elsif domain_is_local?
@@ -36,6 +36,10 @@ class AccountSearchService < BaseService
         Account.find_remote(query_username, query_domain)
       end
     end
+
+    match = nil if !match.nil? && !account.nil? && options[:following] && !account.following?(match)
+
+    @exact_match = match
   end
 
   def search_results