about summary refs log tree commit diff
path: root/app/workers/activitypub/distribute_poll_update_worker.rb
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2019-06-04 23:11:18 +0200
committerGitHub <noreply@github.com>2019-06-04 23:11:18 +0200
commitf2b743e715758f6af818f68fb77cd44d2451ae48 (patch)
tree9221aaac28376655038631851da7228c040b2077 /app/workers/activitypub/distribute_poll_update_worker.rb
parent48fee1a800a262ce26171d724c15738d083eb6d6 (diff)
Refactor all ActivityPub deliveries to be serialized and signed through one concern (#10966)
Diffstat (limited to 'app/workers/activitypub/distribute_poll_update_worker.rb')
-rw-r--r--app/workers/activitypub/distribute_poll_update_worker.rb15
1 files changed, 2 insertions, 13 deletions
diff --git a/app/workers/activitypub/distribute_poll_update_worker.rb b/app/workers/activitypub/distribute_poll_update_worker.rb
index 5eaca6fda..1e87fa4bf 100644
--- a/app/workers/activitypub/distribute_poll_update_worker.rb
+++ b/app/workers/activitypub/distribute_poll_update_worker.rb
@@ -2,6 +2,7 @@
 
 class ActivityPub::DistributePollUpdateWorker
   include Sidekiq::Worker
+  include Payloadable
 
   sidekiq_options queue: 'push', unique: :until_executed, retry: 0
 
@@ -41,20 +42,8 @@ class ActivityPub::DistributePollUpdateWorker
     @inboxes
   end
 
-  def signed_payload
-    Oj.dump(ActivityPub::LinkedDataSignature.new(unsigned_payload).sign!(@account))
-  end
-
-  def unsigned_payload
-    ActiveModelSerializers::SerializableResource.new(
-      @status,
-      serializer: ActivityPub::UpdatePollSerializer,
-      adapter: ActivityPub::Adapter
-    ).as_json
-  end
-
   def payload
-    @payload ||= @status.distributable? ? signed_payload : Oj.dump(unsigned_payload)
+    @payload ||= Oj.dump(serialize_payload(@status, ActivityPub::UpdatePollSerializer, signer: @account))
   end
 
   def relay!