Fix test
This commit is contained in:
parent
2af34ac0d9
commit
6f074e88a7
2 changed files with 7 additions and 7 deletions
|
@ -423,10 +423,10 @@ class FeedManager
|
||||||
# @param [Integer] receiver_id
|
# @param [Integer] receiver_id
|
||||||
# @param [Hash] crutches
|
# @param [Hash] crutches
|
||||||
# @return [void|Symbol] nil, :skip_home, or :filter
|
# @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 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 :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?
|
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)
|
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] || []
|
check_for_blocks = crutches[:active_mentions][status.id] || []
|
||||||
|
|
|
@ -202,7 +202,7 @@ RSpec.describe FeedManager do
|
||||||
antenna.accounts << bob
|
antenna.accounts << bob
|
||||||
allow(Antenna).to receive(:where).and_return(antenna)
|
allow(Antenna).to receive(:where).and_return(antenna)
|
||||||
status = Fabricate(:status, text: 'I post a lot', account: bob)
|
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
|
end
|
||||||
|
|
||||||
it 'returns true for reblog from followee on exclusive antenna' do
|
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)
|
allow(Antenna).to receive(:where).and_return(antenna)
|
||||||
status = Fabricate(:status, text: 'I post a lot', account: bob)
|
status = Fabricate(:status, text: 'I post a lot', account: bob)
|
||||||
reblog = Fabricate(:status, reblog: status, account: jeff)
|
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
|
end
|
||||||
|
|
||||||
it 'returns false for post from followee on non-exclusive antenna' do
|
it 'returns false for post from followee on non-exclusive antenna' do
|
||||||
|
@ -220,7 +220,7 @@ RSpec.describe FeedManager do
|
||||||
alice.follow!(bob)
|
alice.follow!(bob)
|
||||||
antenna.accounts << bob
|
antenna.accounts << bob
|
||||||
status = Fabricate(:status, text: 'I post a lot', account: 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
|
end
|
||||||
|
|
||||||
it 'returns false for reblog from followee on non-exclusive antenna' do
|
it 'returns false for reblog from followee on non-exclusive antenna' do
|
||||||
|
@ -229,7 +229,7 @@ RSpec.describe FeedManager do
|
||||||
antenna.accounts << jeff
|
antenna.accounts << jeff
|
||||||
status = Fabricate(:status, text: 'I post a lot', account: bob)
|
status = Fabricate(:status, text: 'I post a lot', account: bob)
|
||||||
reblog = Fabricate(:status, reblog: status, account: jeff)
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue