瀏覽代碼

Fix following restriction not working when exact match in account search (#14394)

Takeshi Umeda 3 年之前
父節點
當前提交
156af70e4d
共有 1 個文件被更改,包括 5 次插入1 次删除
  1. 5 1
      app/services/account_search_service.rb

+ 5 - 1
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