From 1f650d327d35bc48b897da99914c43750d8e5fd3 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Fri, 7 Oct 2016 16:00:11 +0200 Subject: Adding public timeline --- app/lib/feed_manager.rb | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'app/lib') diff --git a/app/lib/feed_manager.rb b/app/lib/feed_manager.rb index 58d6a005c..46a105124 100644 --- a/app/lib/feed_manager.rb +++ b/app/lib/feed_manager.rb @@ -33,22 +33,6 @@ class FeedManager redis.zremrangebyscore(key(type, account_id), '-inf', "(#{last.last}") end - private - - def redis - $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, receiver) - replied_to_user = status.reply? ? status.thread.account : nil - (status.reply? && !(receiver.id == replied_to_user.id || replied_to_user.id == status.account_id || receiver.following?(replied_to_user))) - end - - def filter_from_mentions?(status, receiver) - receiver.blocking?(status.account) || (status.reblog? && receiver.blocking?(status.reblog.account)) - end - def inline_render(target_account, status) rabl_scope = Class.new do include RoutingHelper @@ -58,7 +42,7 @@ class FeedManager end def current_user - @account.user + @account.try(:user) end def current_account @@ -68,4 +52,20 @@ class FeedManager Rabl::Renderer.new('api/v1/statuses/show', status, view_path: 'app/views', format: :json, scope: rabl_scope.new(target_account)).render end + + private + + def redis + $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, receiver) + replied_to_user = status.reply? ? status.thread.account : nil + (status.reply? && !(receiver.id == replied_to_user.id || replied_to_user.id == status.account_id || receiver.following?(replied_to_user))) || (status.reblog? && receiver.blocking?(status.reblog.account)) + end + + def filter_from_mentions?(status, receiver) + receiver.blocking?(status.account) + end end -- cgit