From 381ecf1d0b2a596d682d2d07c87e2ca66ebc0a64 Mon Sep 17 00:00:00 2001 From: Takeshi Umeda Date: Mon, 27 Jul 2020 06:58:36 +0900 Subject: [PATCH] Fix following restriction not working when exact match in account search (#14394) --- app/services/account_search_service.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/services/account_search_service.rb b/app/services/account_search_service.rb index 493813aab4..43e5960405 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