Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
kmycode committed Dec 4, 2024
1 parent 2af34ac commit 6f074e8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions app/lib/feed_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -423,10 +423,10 @@ def blocks_or_mutes?(receiver_id, account_ids, context)
# @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] || []
Expand Down
8 changes: 4 additions & 4 deletions spec/lib/feed_manager_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@
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
Expand All @@ -212,15 +212,15 @@
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
list.exclusive = false
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
Expand All @@ -229,7 +229,7 @@
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

Expand Down

0 comments on commit 6f074e8

Please sign in to comment.