diff options
author | ThibG <thib@sitedethib.com> | 2019-04-01 20:06:13 +0200 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2019-04-01 20:06:13 +0200 |
commit | 62bafa20a112ccdddaedb25723fc819dbbcd8e9a (patch) | |
tree | bfad870e5366780dc13cc65280268695eb807858 /app/services | |
parent | 67eb47e25f1e7704dd9ecd32695ff3b53c807375 (diff) |
Hide blocking accounts from blocked users (#10442)
* Revert "Add indication that you have been blocked in web UI (#10420)" This reverts commit bd02ec6daa974dcd3231e73826a56e08dbeedadc. * Revert "Add `blocked_by` relationship to the REST API (#10373)" This reverts commit 9745de883b198375ba23f7fde879f6d75ce2df0f. * Hide blocking accounts from search results * Filter blocking accouts from account followers * Filter blocking accouts from account's following accounts * Filter blocking accounts from “reblogged by” and “favourited by” lists * Remove blocking account from URL search * Return 410 on trying to fetch user data from a user who blocked us * Return 410 in /api/v1/account/statuses for suspended or blocking accounts * Fix status filtering when performing URL search * Restore some React improvements Restore some cleanup from bd02ec6daa974dcd3231e73826a56e08dbeedadc * Refactor by adding `without_blocking` scope
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/account_search_service.rb | 10 | ||||
-rw-r--r-- | app/services/search_service.rb | 2 |
2 files changed, 11 insertions, 1 deletions
diff --git a/app/services/account_search_service.rb b/app/services/account_search_service.rb index 7bdffbbd2..c47b1c094 100644 --- a/app/services/account_search_service.rb +++ b/app/services/account_search_service.rb @@ -10,7 +10,15 @@ class AccountSearchService < BaseService @options = options @account = account - search_service_results + results = search_service_results + + unless account.nil? + account_ids = results.map(&:id) + blocked_by_map = Account.blocked_by_map(account_ids, account.id) + results.reject! { |item| blocked_by_map[item.id] } + end + + results end private diff --git a/app/services/search_service.rb b/app/services/search_service.rb index e0da61dac..a8442654c 100644 --- a/app/services/search_service.rb +++ b/app/services/search_service.rb @@ -12,6 +12,8 @@ class SearchService < BaseService default_results.tap do |results| if url_query? results.merge!(url_resource_results) unless url_resource.nil? + results[:accounts].reject! { |item| item.blocking?(@account) } + results[:statuses].reject! { |status| StatusFilter.new(status, @account).filtered? } elsif @query.present? results[:accounts] = perform_accounts_search! if account_searchable? results[:statuses] = perform_statuses_search! if full_text_searchable? |