Refactor all ActivityPub deliveries to be serialized and signed through one concern (#10966)

This commit is contained in:
Eugen Rochko
2019-06-04 23:11:18 +02:00
committed by GitHub
parent 48fee1a800
commit f2b743e715
24 changed files with 79 additions and 153 deletions

View File

@ -3,6 +3,7 @@
class ReblogService < BaseService
include Authorization
include StreamEntryRenderer
include Payloadable
# Reblog a status and notify its remote author
# @param [Account] account Account to reblog from
@ -53,10 +54,6 @@ class ReblogService < BaseService
end
def build_json(reblog)
Oj.dump(ActivityPub::LinkedDataSignature.new(ActiveModelSerializers::SerializableResource.new(
reblog,
serializer: ActivityPub::ActivitySerializer,
adapter: ActivityPub::Adapter
).as_json).sign!(reblog.account))
Oj.dump(serialize_payload(reblog, ActivityPub::ActivitySerializer, signer: reblog.account))
end
end