Class: ActivityPub::DistributionJob

Inherits:
ApplicationJob show all
Defined in:
app/jobs/activitypub/distribution_job.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.call(resource) ⇒ Object



4
5
6
# File 'app/jobs/activitypub/distribution_job.rb', line 4

def self.call(resource)
  ActivityPub::DistributionJob.perform_later(resource.class.name, resource.id)
end

Instance Method Details

#perform(resource_type, resource_id) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/jobs/activitypub/distribution_job.rb', line 8

def perform(resource_type, resource_id)
  @resource = resource_type.constantize.find(resource_id)
  @account = @resource.

  inboxes.each do |inbox_url|
    ActivityPub::DeliveryJob.perform_later(
      signed_payload, @account.id, inbox_url
    )
  end

rescue ActiveRecord::RecordNotFound
  true
end