Fix: 引用投稿のActivity発行でエラーが出る問題 (#878)

This commit is contained in:
KMY(雪あすか) 2024-10-11 08:32:58 +09:00 committed by GitHub
parent df88076e68
commit e080fae9ef
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -161,16 +161,27 @@ class ActivityPub::NoteSerializer < ActivityPub::Serializer
object.active_mentions.to_a.sort_by(&:id) + object.tags + object.emojis + virtual_tags_of_quote
end
class NoteLink < ActiveModelSerializers::Model
attributes :href
end
class NoteLinkSerializer < ActivityPub::Serializer
attributes :type, :href
attribute :media_type, key: :mediaType
def type
'Link'
end
def media_type
'application/ld+json; profile="https://www.w3.org/ns/activitystreams"'
end
end
def virtual_tags_of_quote
return [] unless object.quote?
[
{
type: 'Link',
mediaType: 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"',
href: quote_uri,
},
]
[NoteLink.new(href: quote_uri)]
end
def atom_uri