Add experimental basic quote post authoring (#35355)
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
class ActivityPub::NoteSerializer < ActivityPub::Serializer
|
||||
include FormattingHelper
|
||||
|
||||
context_extensions :atom_uri, :conversation, :sensitive, :voters_count
|
||||
context_extensions :atom_uri, :conversation, :sensitive, :voters_count, :quotes
|
||||
|
||||
attributes :id, :type, :summary,
|
||||
:in_reply_to, :published, :url,
|
||||
@@ -30,6 +30,11 @@ class ActivityPub::NoteSerializer < ActivityPub::Serializer
|
||||
|
||||
attribute :voters_count, if: :poll_and_voters_count?
|
||||
|
||||
attribute :quote, if: :quote?
|
||||
attribute :quote, key: :_misskey_quote, if: :quote?
|
||||
attribute :quote, key: :quote_uri, if: :quote?
|
||||
attribute :quote_authorization, if: :quote_authorization?
|
||||
|
||||
def id
|
||||
ActivityPub::TagManager.instance.uri_for(object)
|
||||
end
|
||||
@@ -194,6 +199,24 @@ class ActivityPub::NoteSerializer < ActivityPub::Serializer
|
||||
object.preloadable_poll&.voters_count
|
||||
end
|
||||
|
||||
def quote?
|
||||
object.quote&.present?
|
||||
end
|
||||
|
||||
def quote_authorization?
|
||||
object.quote&.approval_uri.present?
|
||||
end
|
||||
|
||||
def quote
|
||||
# TODO: handle inlining self-quotes
|
||||
ActivityPub::TagManager.instance.uri_for(object.quote.quoted_status)
|
||||
end
|
||||
|
||||
def quote_authorization
|
||||
# TODO: approval of local quotes may work differently, perhaps?
|
||||
object.quote.approval_uri
|
||||
end
|
||||
|
||||
class MediaAttachmentSerializer < ActivityPub::Serializer
|
||||
context_extensions :blurhash, :focal_point
|
||||
|
||||
|
||||
Reference in New Issue
Block a user