0
0
Fork 0

Adding public timeline

This commit is contained in:
Eugen Rochko 2016-10-07 16:00:11 +02:00
parent 06016453bd
commit 1f650d327d
21 changed files with 229 additions and 71 deletions

View file

@ -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