Adding exclusive lists feature

Major new feature, currently testing in a branch right now. Fixes #1
This commit is contained in:
Darius Kazemi
2019-07-26 01:51:20 -07:00
parent dc15521b3a
commit bfc0fbab2c
14 changed files with 76 additions and 23 deletions

View File

@ -22,6 +22,8 @@ class FeedManager
filter_from_home?(status, receiver_id)
elsif timeline_type == :mentions
filter_from_mentions?(status, receiver_id)
elsif timeline_type == :list
filter_from_home?(status, receiver_id, :list)
else
false
end
@ -152,10 +154,17 @@ class FeedManager
(context == :home ? Mute.where(account_id: receiver_id, target_account_id: account_ids).any? : Mute.where(account_id: receiver_id, target_account_id: account_ids, hide_notifications: true).any?)
end
def filter_from_home?(status, receiver_id)
def filter_from_home?(status, receiver_id, timeline_type=:home)
return false if receiver_id == status.account_id
return true if status.reply? && (status.in_reply_to_id.nil? || status.in_reply_to_account_id.nil?)
return true if phrase_filtered?(status, receiver_id, :home)
# hometown: exclusive list rules
unless timeline_type == :list
# find all exclusive lists
@list = List.where(account: Account.find(receiver_id), is_exclusive: true)
# is there a list the receiver owns with this account on it? if so, return true
return true if ListAccount.where(list: @list, account_id: status.account_id).exists?
end
check_for_blocks = status.active_mentions.pluck(:account_id)
check_for_blocks.concat([status.account_id])