about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTakeshi Umeda <noel.yoshiba@gmail.com>2020-07-27 06:58:36 +0900
committerGitHub <noreply@github.com>2020-07-26 23:58:36 +0200
commit156af70e4d01f8bf65cdede554c37ab8f9817036 (patch)
tree7e1621fdb2d0deba94329a9273cbd9454b16c7db
parentd1a6f8d5a8d187ad7e0d9e683f8054f207270931 (diff)
Fix following restriction not working when exact match in account search (#14394)
-rw-r--r--app/services/account_search_service.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/services/account_search_service.rb b/app/services/account_search_service.rb
index 493813aab..43e596040 100644
--- a/app/services/account_search_service.rb
+++ b/app/services/account_search_service.rb
@@ -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