about summary refs log tree commit diff
path: root/app/services/after_block_domain_from_account_service.rb
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2019-06-04 23:11:18 +0200
committermultiple creatures <dev@multiple-creature.party>2019-11-19 16:32:36 -0600
commitfbf08920a0d73231c04b35c263ea4e04224b6e7d (patch)
treeafc2717ba1e5b121d170d0d5adc5236cf73f78dd /app/services/after_block_domain_from_account_service.rb
parent82bd234c3cb4aed81ab4e4c8844bd27d065ea4d9 (diff)
Refactor all ActivityPub deliveries to be serialized and signed through one concern (#10966)
Diffstat (limited to 'app/services/after_block_domain_from_account_service.rb')
-rw-r--r--app/services/after_block_domain_from_account_service.rb10
1 files changed, 4 insertions, 6 deletions
diff --git a/app/services/after_block_domain_from_account_service.rb b/app/services/after_block_domain_from_account_service.rb
index f12f18319..a87c2e792 100644
--- a/app/services/after_block_domain_from_account_service.rb
+++ b/app/services/after_block_domain_from_account_service.rb
@@ -1,6 +1,8 @@
 # frozen_string_literal: true
 
 class AfterBlockDomainFromAccountService < BaseService
+  include Payloadable
+
   # This service does not create an AccountDomainBlock record,
   # it's meant to be called after such a record has been created
   # synchronously, to "clean up"
@@ -29,12 +31,8 @@ class AfterBlockDomainFromAccountService < BaseService
   def reject_follow!(follow)
     follow.destroy
 
-    json = ActiveModelSerializers::SerializableResource.new(
-      follow,
-      serializer: ActivityPub::RejectFollowSerializer,
-      adapter: ActivityPub::Adapter
-    ).to_json
+    return unless follow.account.activitypub?
 
-    ActivityPub::DeliveryWorker.perform_async(json, @account.id, follow.account.inbox_url)
+    ActivityPub::DeliveryWorker.perform_async(Oj.dump(serialize_payload(follow, ActivityPub::RejectFollowSerializer)), @account.id, follow.account.inbox_url)
   end
 end