diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2017-08-26 18:52:53 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-26 18:52:53 +0200 |
commit | 0397c58b61d8a364ff488fc5631bfc751903c242 (patch) | |
tree | 89c98b42dac413fba86c5202d6e5844cc99942b4 /app/workers | |
parent | 884b085f534b02c664bcddd3a2fefcad6d4e5cc4 (diff) |
Forward ActivityPub deletes to followers of rebloggers (#4706)
Diffstat (limited to 'app/workers')
-rw-r--r-- | app/workers/activitypub/raw_distribution_worker.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/app/workers/activitypub/raw_distribution_worker.rb b/app/workers/activitypub/raw_distribution_worker.rb new file mode 100644 index 000000000..d73466f6e --- /dev/null +++ b/app/workers/activitypub/raw_distribution_worker.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +class ActivityPub::RawDistributionWorker + include Sidekiq::Worker + + sidekiq_options queue: 'push' + + def perform(json, source_account_id) + @account = Account.find(source_account_id) + + ActivityPub::DeliveryWorker.push_bulk(inboxes) do |inbox_url| + [json, @account.id, inbox_url] + end + rescue ActiveRecord::RecordNotFound + true + end + + private + + def inboxes + @inboxes ||= @account.followers.inboxes + end +end |