Revert "Upstream 20240517"

This commit is contained in:
KMY(雪あすか) 2024-05-24 08:15:12 +09:00 committed by GitHub
parent 9c006fd893
commit f6dec44e95
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2347 changed files with 26470 additions and 87494 deletions

View file

@ -9,8 +9,6 @@ class FeedInsertWorker
@type = type.to_sym
@status = Status.find(status_id)
@options = options.symbolize_keys
@antenna = Antenna.find(@options[:antenna_id]) if @options[:antenna_id].present?
@pushed = false
case @type
when :home, :tags
@ -18,17 +16,12 @@ class FeedInsertWorker
when :list
@list = List.find(id)
@follower = @list.account
when :antenna
@antenna = Antenna.find(id)
@follower = @antenna.account
end
end
with_read_replica do
check_and_insert
end
perform_notify_for_list if !feed_filtered? && notify_for_list?
rescue ActiveRecord::RecordNotFound
true
end
@ -46,12 +39,12 @@ class FeedInsertWorker
def feed_filtered?
case @type
when :home, :antenna
when :home
FeedManager.instance.filter?(:home, @status, @follower)
when :tags
FeedManager.instance.filter?(:tags, @status, @follower)
when :list
FeedManager.instance.filter?(:list, @status, @list, stl_home: stl_home?)
FeedManager.instance.filter?(:list, @status, @list)
end
end
@ -61,25 +54,13 @@ class FeedInsertWorker
Follow.find_by(account: @follower, target_account: @status.account)&.notify?
end
def notify_for_list?
return false if @type != :list || update? || !@pushed
@list.notify?
end
def perform_push
if @antenna.nil? || @antenna.insert_feeds
case @type
when :home, :tags
@pushed = FeedManager.instance.push_to_home(@follower, @status, update: update?)
when :list
@pushed = FeedManager.instance.push_to_list(@list, @status, update: update?)
end
case @type
when :home, :tags
FeedManager.instance.push_to_home(@follower, @status, update: update?)
when :list
FeedManager.instance.push_to_list(@list, @status, update: update?)
end
return if @antenna.nil?
FeedManager.instance.push_to_antenna(@antenna, @status, update: update?)
end
def perform_unpush
@ -89,26 +70,13 @@ class FeedInsertWorker
when :list
FeedManager.instance.unpush_from_list(@list, @status, update: true)
end
return if @antenna.nil?
FeedManager.instance.unpush_from_antenna(@antenna, @status, update: true)
end
def perform_notify
LocalNotificationWorker.perform_async(@follower.id, @status.id, 'Status', 'status')
end
def perform_notify_for_list
list_status = ListStatus.create!(list: @list, status: @status)
LocalNotificationWorker.perform_async(@list.account_id, list_status.id, 'ListStatus', 'list_status')
end
def update?
@options[:update]
end
def stl_home?
@options[:stl_home]
end
end