about summary refs log tree commit diff
path: root/app/lib/feed_manager.rb
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-11-10 00:03:33 +0100
committerEugen Rochko <eugen@zeonfederated.com>2016-11-10 00:03:33 +0100
commit17903c6dae9eb38ac221fb7cf86e5e3cafe465d0 (patch)
tree4f1d32a1ec9b770407a919bcc46794fcc09f339b /app/lib/feed_manager.rb
parentc5e03a2e0d7eac132a5d62d1d7d523a6969697cc (diff)
Improve filtering of public/hashtag timelines, both in backlog and real-time
Diffstat (limited to 'app/lib/feed_manager.rb')
-rw-r--r--app/lib/feed_manager.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/app/lib/feed_manager.rb b/app/lib/feed_manager.rb
index af7b2380e..fe88c0fb9 100644
--- a/app/lib/feed_manager.rb
+++ b/app/lib/feed_manager.rb
@@ -14,6 +14,8 @@ class FeedManager
       filter_from_home?(status, receiver)
     elsif timeline_type == :mentions
       filter_from_mentions?(status, receiver)
+    elsif timeline_type == :public
+      filter_from_public?(status, receiver)
     else
       false
     end
@@ -80,4 +82,16 @@ class FeedManager
     should_filter = should_filter || receiver.blocking?(status.account) # or it's from someone I blocked
     should_filter
   end
+
+  def filter_from_public?(status, receiver)
+    should_filter = receiver.blocking?(status.account)
+
+    if status.reply? && !status.thread.account.nil?
+      should_filter = should_filter || receiver.blocking?(status.thread.account)
+    elsif status.reblog?
+      should_filter = should_filter || receiver.blocking?(status.reblog.account)
+    end
+
+    should_filter
+  end
 end