Compare commits

...

2 commits

Author SHA1 Message Date
beatrix-bitrot 1ba51a4c35 add test 2017-10-19 22:00:03 +00:00
beatrix-bitrot b10608299e hide mentions of muted accounts (in home col)
also cleans up some old crap
2017-10-19 21:38:41 +00:00
2 changed files with 8 additions and 6 deletions

View file

@ -138,16 +138,11 @@ class FeedManager
end
def filter_from_home?(status, receiver_id)
# extremely violent filtering code BEGIN
#filter_string = 'e'
#reggie = Regexp.new(filter_string)
#return true if reggie === status.content || reggie === status.spoiler_text
# extremely violent filtering code END
return false if receiver_id == status.account_id
return true if status.reply? && (status.in_reply_to_id.nil? || status.in_reply_to_account_id.nil?)
check_for_mutes = [status.account_id]
check_for_mutes.concat(status.mentions.pluck(:account_id))
check_for_mutes.concat([status.reblog.account_id]) if status.reblog?
return true if Mute.where(account_id: receiver_id, target_account_id: check_for_mutes).any?

View file

@ -105,6 +105,13 @@ RSpec.describe FeedManager do
expect(FeedManager.instance.filter?(:home, status, bob.id)).to be true
end
it 'returns true for status by followee mentioning muted account' do
bob.mute!(jeff)
bob.follow!(alice)
status = PostStatusService.new.call(alice, 'Hey @jeff')
expect(FeedManager.instance.filter?(:home, status, bob.id)).to be true
end
it 'returns true for reblog of a personally blocked domain' do
alice.block_domain!('example.com')
alice.follow!(jeff)