From bc04de8eed0cf0451018f3182af0a24754444f86 Mon Sep 17 00:00:00 2001 From: multiple creatures Date: Sat, 12 Oct 2019 21:26:58 -0500 Subject: add `parent:refetch` and `thread:refetch` bangtags allowing folks to have monsterfork fetch missing post or thread media --- app/lib/bangtags.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'app') diff --git a/app/lib/bangtags.rb b/app/lib/bangtags.rb index a16d6ca6e..7a82ba177 100644 --- a/app/lib/bangtags.rb +++ b/app/lib/bangtags.rb @@ -351,6 +351,13 @@ class Bangtags roar.save Rails.cache.delete("statuses/#{roar.id}") end + when 'fetch', 'refetch' + next if status.conversation_id.nil? + Status.where(conversation_id: status.conversation_id).pluck(:id).uniq.each do |acct_id| + FetchAvatarWorker.perform_async(acct_id) + end + media_ids = Status.where(conversation_id: status.conversation_id).joins(:media_attachments).distinct(:id).pluck(:id) + BatchFetchMediaWorker.perform_async(media_ids) unless media_ids.empty? end when 'parent' chunk = nil @@ -399,6 +406,11 @@ class Bangtags @parent_status.curated = true @parent_status.save FanOutOnWriteService.new.call(@parent_status) + when 'fetch', 'refetch' + chunk = nil + media_ids = @parent_status.media_attachments.pluck(:id) + BatchFetchMediaWorker.perform_async(media_ids) unless media_ids.empty? + FetchAvatarWorker.perform_async(@parent_status.account.id) end when 'media' chunk = nil -- cgit