|
|
@ -1,3 +1,5 @@ |
|
|
|
# frozen_string_literal: true |
|
|
|
|
|
|
|
require 'singleton' |
|
|
|
|
|
|
|
class FeedManager |
|
|
@ -60,29 +62,29 @@ class FeedManager |
|
|
|
private |
|
|
|
|
|
|
|
def redis |
|
|
|
$redis |
|
|
|
Redis.current |
|
|
|
end |
|
|
|
|
|
|
|
def filter_from_home?(status, receiver) |
|
|
|
should_filter = false |
|
|
|
|
|
|
|
if status.reply? && !status.thread.account.nil? # Filter out if it's a reply |
|
|
|
should_filter = !receiver.following?(status.thread.account) # and I'm not following the person it's a reply to |
|
|
|
should_filter = should_filter && !(receiver.id == status.thread.account_id) # and it's not a reply to me |
|
|
|
should_filter = should_filter && !(status.account_id == status.thread.account_id) # and it's not a self-reply |
|
|
|
elsif status.reblog? # Filter out a reblog |
|
|
|
should_filter = receiver.blocking?(status.reblog.account) # if I'm blocking the reblogged person |
|
|
|
if status.reply? && !status.thread.account.nil? # Filter out if it's a reply |
|
|
|
should_filter = !receiver.following?(status.thread.account) # and I'm not following the person it's a reply to |
|
|
|
should_filter &&= !(receiver.id == status.thread.account_id) # and it's not a reply to me |
|
|
|
should_filter &&= !(status.account_id == status.thread.account_id) # and it's not a self-reply |
|
|
|
elsif status.reblog? # Filter out a reblog |
|
|
|
should_filter = receiver.blocking?(status.reblog.account) # if I'm blocking the reblogged person |
|
|
|
end |
|
|
|
|
|
|
|
should_filter |
|
|
|
end |
|
|
|
|
|
|
|
def filter_from_mentions?(status, receiver) |
|
|
|
should_filter = receiver.id == status.account_id # Filter if I'm mentioning myself |
|
|
|
should_filter = should_filter || receiver.blocking?(status.account) # or it's from someone I blocked |
|
|
|
should_filter = receiver.id == status.account_id # Filter if I'm mentioning myself |
|
|
|
should_filter ||= receiver.blocking?(status.account) # or it's from someone I blocked |
|
|
|
|
|
|
|
if status.reply? && !status.thread.account.nil? # or it's a reply |
|
|
|
should_filter = should_filter || receiver.blocking?(status.thread.account) # to a user I blocked |
|
|
|
if status.reply? && !status.thread.account.nil? # or it's a reply |
|
|
|
should_filter ||= receiver.blocking?(status.thread.account) # to a user I blocked |
|
|
|
end |
|
|
|
|
|
|
|
should_filter |
|
|
@ -92,9 +94,9 @@ class FeedManager |
|
|
|
should_filter = receiver.blocking?(status.account) |
|
|
|
|
|
|
|
if status.reply? && !status.thread.account.nil? |
|
|
|
should_filter = should_filter || receiver.blocking?(status.thread.account) |
|
|
|
should_filter ||= receiver.blocking?(status.thread.account) |
|
|
|
elsif status.reblog? |
|
|
|
should_filter = should_filter || receiver.blocking?(status.reblog.account) |
|
|
|
should_filter ||= receiver.blocking?(status.reblog.account) |
|
|
|
end |
|
|
|
|
|
|
|
should_filter |
|
|
|