From e76a34ee42763fbf0d0252e54002ebe5fcb4b92c Mon Sep 17 00:00:00 2001 From: Fire Demon Date: Wed, 12 Aug 2020 22:33:12 -0500 Subject: [Moderation] Limit scope of admin-level silences to timelines, search, and accounts not following or followed by the user --- app/services/notify_service.rb | 7 ++++++- app/services/search_service.rb | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'app/services') diff --git a/app/services/notify_service.rb b/app/services/notify_service.rb index 9364a6ae8..5f12a6b97 100644 --- a/app/services/notify_service.rb +++ b/app/services/notify_service.rb @@ -47,6 +47,11 @@ class NotifyService < BaseService @following_sender = @recipient.following?(@notification.from_account) || @recipient.requested?(@notification.from_account) end + def following_recipient? + return @following_recipient if defined?(@following_recipient) + @following_recipient = @notification.from_account.following?(@recipient) + end + def optional_non_follower? @recipient.user.settings.interactions['must_be_follower'] && !@notification.from_account.following?(@recipient) end @@ -79,7 +84,7 @@ class NotifyService < BaseService end def hellbanned? - @notification.from_account.silenced? && !following_sender? + @notification.from_account.silenced? && !(following_sender? || following_recipient?) end def from_self? diff --git a/app/services/search_service.rb b/app/services/search_service.rb index 19500a8d4..819ce2c16 100644 --- a/app/services/search_service.rb +++ b/app/services/search_service.rb @@ -53,7 +53,7 @@ class SearchService < BaseService account_domains = results.map(&:account_domain) preloaded_relations = relations_map_for_account(@account, account_ids, account_domains) - results.reject { |status| StatusFilter.new(status, @account, preloaded_relations).filtered? } + results.reject { |status| StatusFilter.new(status, @account, true, preloaded_relations).filtered? } rescue Faraday::ConnectionFailed, Parslet::ParseFailed [] end -- cgit