diff --git a/app/lib/feed_manager.rb b/app/lib/feed_manager.rb index 2ca231c103..c6b4840bb0 100644 --- a/app/lib/feed_manager.rb +++ b/app/lib/feed_manager.rb @@ -423,10 +423,10 @@ class FeedManager # @param [Integer] receiver_id # @param [Hash] crutches # @return [void|Symbol] nil, :skip_home, or :filter - def filter_from_home(status, receiver_id, crutches, timeline_type = :home, stl_home: false) # rubocop:disable Metrics/PerceivedComplexity + def filter_from_home(status, receiver_id, crutches, timeline_type = :home, stl_home: false) # rubocop:disable Metrics/PerceivedComplexity, Metrics/AbcSize return if receiver_id == status.account_id - return :filter if status.reply? && (status.in_reply_to_id.nil? || status.in_reply_to_account_id.nil?) - return :skip_home if (timeline_type != :list || stl_home) && crutches[:exclusive_list_users][status.account_id].present? + return :filter if status.reply? && (status.in_reply_to_id.nil? || status.in_reply_to_account_id.nil?) && !(timeline_type == :home && status.limited_visibility?) + return :skip_home if (timeline_type != :list || stl_home) && (crutches[:exclusive_list_users][status.account_id].present? || crutches[:exclusive_antenna_users][status.account_id].present?) return :filter if crutches[:languages][status.account_id].present? && status.language.present? && !crutches[:languages][status.account_id].include?(status.language) check_for_blocks = crutches[:active_mentions][status.id] || [] diff --git a/spec/lib/feed_manager_spec.rb b/spec/lib/feed_manager_spec.rb index c3717a616e..ad7913c758 100644 --- a/spec/lib/feed_manager_spec.rb +++ b/spec/lib/feed_manager_spec.rb @@ -202,7 +202,7 @@ RSpec.describe FeedManager do antenna.accounts << bob allow(Antenna).to receive(:where).and_return(antenna) status = Fabricate(:status, text: 'I post a lot', account: bob) - expect(described_class.instance.filter?(:home, status, alice)).to be true + expect(subject.filter?(:home, status, alice)).to be true end it 'returns true for reblog from followee on exclusive antenna' do @@ -212,7 +212,7 @@ RSpec.describe FeedManager do allow(Antenna).to receive(:where).and_return(antenna) status = Fabricate(:status, text: 'I post a lot', account: bob) reblog = Fabricate(:status, reblog: status, account: jeff) - expect(described_class.instance.filter?(:home, reblog, alice)).to be true + expect(subject.filter?(:home, reblog, alice)).to be true end it 'returns false for post from followee on non-exclusive antenna' do @@ -220,7 +220,7 @@ RSpec.describe FeedManager do alice.follow!(bob) antenna.accounts << bob status = Fabricate(:status, text: 'I post a lot', account: bob) - expect(described_class.instance.filter?(:home, status, alice)).to be false + expect(subject.filter?(:home, status, alice)).to be false end it 'returns false for reblog from followee on non-exclusive antenna' do @@ -229,7 +229,7 @@ RSpec.describe FeedManager do antenna.accounts << jeff status = Fabricate(:status, text: 'I post a lot', account: bob) reblog = Fabricate(:status, reblog: status, account: jeff) - expect(described_class.instance.filter?(:home, reblog, alice)).to be false + expect(subject.filter?(:home, reblog, alice)).to be false end end