]> cat aescling's git repositories - mastodon.git/commitdiff
hide mentions of muted accounts (in home col) (#190)
authorbeatrix <beatrix.bitrot@gmail.com>
Fri, 20 Oct 2017 14:49:54 +0000 (10:49 -0400)
committerGitHub <noreply@github.com>
Fri, 20 Oct 2017 14:49:54 +0000 (10:49 -0400)
* hide mentions of muted accounts (in home col)

also cleans up some old crap

* add test

app/lib/feed_manager.rb
spec/lib/feed_manager_spec.rb

index 39d3333dae1580dc4097530f1bd0063f66088c25..ca15745cb141e9cd6d3f3f697f89ad80278e1387 100644 (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?
index 0f97a579e3078d46c63554ce7909e9f0cadef37b..1861cc6edfb74dc178787249a3aba8cef6f4eafc 100644 (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)
This page took 0.02438 seconds and 3 git commands to generate.