From be86d4e0a3c40e95648971bc9b0fe58c58cbc5da Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Sun, 2 Oct 2016 15:28:47 +0200 Subject: Preparing feeds for better filtering --- app/lib/feed_manager.rb | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'app/lib') diff --git a/app/lib/feed_manager.rb b/app/lib/feed_manager.rb index 6e6df0359..779a31f0b 100644 --- a/app/lib/feed_manager.rb +++ b/app/lib/feed_manager.rb @@ -9,10 +9,12 @@ class FeedManager "feed:#{type}:#{id}" end - # Filter status out of the home feed if it is a reply to someone the user doesn't follow - def filter_status?(status, follower) - replied_to_user = status.reply? ? status.thread.account : nil - (status.reply? && !(follower.id == replied_to_user.id || replied_to_user.id == status.account_id || follower.following?(replied_to_user))) + def filter?(timeline_type, status, receiver) + if timeline_type == :home + filter_from_home?(status, receiver) + else + filter_from_mentions?(status, receiver) + end end def push(timeline_type, account, status) @@ -37,6 +39,16 @@ class FeedManager $redis end + # Filter status out of the home feed if it is a reply to someone the user doesn't follow + def filter_from_home?(status, follower) + replied_to_user = status.reply? ? status.thread.account : nil + (status.reply? && !(follower.id == replied_to_user.id || replied_to_user.id == status.account_id || follower.following?(replied_to_user))) + end + + def filter_from_mentions?(status, follower) + false + end + def inline_render(target_account, status) rabl_scope = Class.new do include RoutingHelper -- cgit