Change NoteObject's quoteURL to quoteUri and introduced fedibird namespace in @context
This commit is contained in:
parent
cb3471e5ec
commit
8f03e3567c
3 changed files with 8 additions and 8 deletions
|
@ -413,7 +413,7 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
|
|||
def text_from_content
|
||||
return Formatter.instance.linkify([[text_from_name, text_from_summary.presence].compact.join("\n\n"), object_url || object_uri].join(' ')) if converted_object_type?
|
||||
|
||||
if @object['quoteUrl'].blank? && @object['_misskey_quote'].present?
|
||||
if @object['quoteUri'].blank? && @object['_misskey_quote'].present?
|
||||
Formatter.instance.linkify(@object['_misskey_content'])
|
||||
elsif @object['content'].present?
|
||||
@object['content']
|
||||
|
@ -554,7 +554,7 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
|
|||
end
|
||||
|
||||
def quote
|
||||
@quote ||= quote_from_url(@object['quoteUrl'] || @object['_misskey_quote'])
|
||||
@quote ||= quote_from_url(@object['quoteUri'] || @object['_misskey_quote'])
|
||||
end
|
||||
|
||||
def process_quote
|
||||
|
|
|
@ -24,8 +24,8 @@ class ActivityPub::Adapter < ActiveModelSerializers::Adapter::Base
|
|||
voters_count: { 'toot' => 'http://joinmastodon.org/ns#', 'votersCount' => 'toot:votersCount' },
|
||||
olm: { 'toot' => 'http://joinmastodon.org/ns#', 'Device' => 'toot:Device', 'Ed25519Signature' => 'toot:Ed25519Signature', 'Ed25519Key' => 'toot:Ed25519Key', 'Curve25519Key' => 'toot:Curve25519Key', 'EncryptedMessage' => 'toot:EncryptedMessage', 'publicKeyBase64' => 'toot:publicKeyBase64', 'deviceId' => 'toot:deviceId', 'claim' => { '@type' => '@id', '@id' => 'toot:claim' }, 'fingerprintKey' => { '@type' => '@id', '@id' => 'toot:fingerprintKey' }, 'identityKey' => { '@type' => '@id', '@id' => 'toot:identityKey' }, 'devices' => { '@type' => '@id', '@id' => 'toot:devices' }, 'messageFranking' => 'toot:messageFranking', 'messageType' => 'toot:messageType', 'cipherText' => 'toot:cipherText' },
|
||||
suspended: { 'toot' => 'http://joinmastodon.org/ns#', 'suspended' => 'toot:suspended' },
|
||||
quoteUrl: { 'quoteUrl' => 'as:quoteUrl' },
|
||||
expiry: { 'toot' => 'http://joinmastodon.org/ns#', 'expiry' => 'toot:expiry' },
|
||||
quote_uri: { 'fedibird' => 'http://fedibird.com/ns#', 'quoteUri' => 'fedibird:quoteUri' },
|
||||
expiry: { 'fedibird' => 'http://fedibird.com/ns#', 'expiry' => 'fedibird:expiry' },
|
||||
}.freeze
|
||||
|
||||
def self.default_key_transform
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class ActivityPub::NoteSerializer < ActivityPub::Serializer
|
||||
context_extensions :atom_uri, :conversation, :sensitive, :voters_count, :expiry
|
||||
context_extensions :atom_uri, :conversation, :sensitive, :voters_count, :quote_uri, :expiry
|
||||
|
||||
attributes :id, :type, :summary,
|
||||
:in_reply_to, :published, :url,
|
||||
|
@ -9,7 +9,7 @@ class ActivityPub::NoteSerializer < ActivityPub::Serializer
|
|||
:atom_uri, :in_reply_to_atom_uri,
|
||||
:conversation, :context
|
||||
|
||||
attribute :quote_url, if: -> { object.quote? }
|
||||
attribute :quote_uri, if: -> { object.quote? }
|
||||
attribute :misskey_quote, key: :_misskey_quote, if: -> { object.quote? }
|
||||
attribute :misskey_content, key: :_misskey_content, if: -> { object.quote? }
|
||||
attribute :content
|
||||
|
@ -138,11 +138,11 @@ class ActivityPub::NoteSerializer < ActivityPub::Serializer
|
|||
end
|
||||
end
|
||||
|
||||
def quote_url
|
||||
def quote_uri
|
||||
ActivityPub::TagManager.instance.uri_for(object.quote) if object.quote?
|
||||
end
|
||||
|
||||
alias misskey_quote quote_url
|
||||
alias misskey_quote quote_uri
|
||||
|
||||
def misskey_content
|
||||
object.text if object.quote?
|
||||
|
|
Loading…
Reference in a new issue