Inline instrument quote post in outgoing QuoteRequest activities (#35713)
This commit is contained in:
1 parent
836a2bfee0
commit
496a5f423e
3 files changed
+17
-5
No files matched your search
@@ -1,11 +1,22 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class ActivityPub::QuoteRequestSerializer < ActivityPub::Serializer
|
||||
def self.serializer_for(model, options)
|
||||
case model.class.name
|
||||
when 'Status'
|
||||
ActivityPub::NoteSerializer
|
||||
else
|
||||
super
|
||||
end
|
||||
end
|
||||
|
||||
context_extensions :quote_requests
|
||||
|
||||
attributes :id, :type, :actor, :instrument
|
||||
attributes :id, :type, :actor
|
||||
attribute :virtual_object, key: :object
|
||||
|
||||
has_one :instrument
|
||||
|
||||
def id
|
||||
object.activity_uri
|
||||
end
|
||||
@@ -23,7 +34,6 @@ class ActivityPub::QuoteRequestSerializer < ActivityPub::Serializer
|
||||
end
|
||||
|
||||
def instrument
|
||||
# TODO: inline object?
|
||||
ActivityPub::TagManager.instance.uri_for(object.status)
|
||||
instance_options[:allow_post_inlining] && object.status.local? ? object.status : ActivityPub::TagManager.instance.uri_for(object.status)
|
||||
end
|
||||
end
|
||||
@@ -17,6 +17,6 @@ class ActivityPub::QuoteRequestWorker < ActivityPub::RawDistributionWorker
|
||||
end
|
||||
|
||||
def payload
|
||||
@payload ||= Oj.dump(serialize_payload(@quote, ActivityPub::QuoteRequestSerializer, signer: @account))
|
||||
@payload ||= Oj.dump(serialize_payload(@quote, ActivityPub::QuoteRequestSerializer, signer: @account, allow_post_inlining: true))
|
||||
end
|
||||
end
|
||||
Reference in new issue
Block a user