Make antenna able to insert home

This commit is contained in:
KMY 2023-05-09 15:07:29 +09:00
parent 7c118ed1d0
commit 9429f5b60c
7 changed files with 34 additions and 8 deletions

View file

@ -118,6 +118,7 @@ class FanOutOnWriteService < BaseService
def deliver_to_antennas!
lists = []
homes = []
tag_ids = @status.tags.pluck(:id)
domain = @account.domain || Rails.configuration.x.local_domain
@ -142,16 +143,27 @@ class FanOutOnWriteService < BaseService
next if antenna.exclude_domains&.include?(domain)
next if antenna.exclude_tags&.any? { |tag_id| tag_ids.include?(tag_id) }
lists << antenna.list_id
if antenna.list_id.zero?
homes << antenna.account_id
else
lists << antenna.list_id
end
end
end
lists = lists.uniq
homes = homes.uniq
if lists.any?
FeedInsertWorker.push_bulk(lists) do |list|
[@status.id, list, 'list', { 'update' => update? }]
end
end
if homes.any?
FeedInsertWorker.push_bulk(homes) do |home|
[@status.id, home, 'home', { 'update' => update? }]
end
end
end
def deliver_to_mentioned_followers!