Refactor all ActivityPub deliveries to be serialized and signed through one concern (#10966)
This commit is contained in:
parent
48fee1a800
commit
f2b743e715
24 changed files with 79 additions and 153 deletions
|
@ -3,6 +3,7 @@
|
|||
class RemoveStatusService < BaseService
|
||||
include StreamEntryRenderer
|
||||
include Redisable
|
||||
include Payloadable
|
||||
|
||||
def call(status, **options)
|
||||
@payload = Oj.dump(event: :delete, payload: status.id.to_s)
|
||||
|
@ -115,15 +116,7 @@ class RemoveStatusService < BaseService
|
|||
end
|
||||
|
||||
def signed_activity_json
|
||||
@signed_activity_json ||= Oj.dump(ActivityPub::LinkedDataSignature.new(activity_json).sign!(@account))
|
||||
end
|
||||
|
||||
def activity_json
|
||||
@activity_json ||= ActiveModelSerializers::SerializableResource.new(
|
||||
@status,
|
||||
serializer: @status.reblog? ? ActivityPub::UndoAnnounceSerializer : ActivityPub::DeleteSerializer,
|
||||
adapter: ActivityPub::Adapter
|
||||
).as_json
|
||||
@signed_activity_json ||= Oj.dump(serialize_payload(@status, @status.reblog? ? ActivityPub::UndoAnnounceSerializer : ActivityPub::DeleteSerializer, signer: @account))
|
||||
end
|
||||
|
||||
def remove_reblogs
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue