parent
eb28fa8e53
commit
f29f3c5c85
4 changed files with 75 additions and 5 deletions
|
@ -634,7 +634,18 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
|
|||
end
|
||||
|
||||
def quote
|
||||
@quote ||= @object['quote'] || @object['quoteUrl'] || @object['quoteURL'] || @object['_misskey_quote']
|
||||
@quote ||= quote_from_tags || @object['quote'] || @object['quoteUrl'] || @object['quoteURL'] || @object['_misskey_quote']
|
||||
end
|
||||
|
||||
LINK_MEDIA_TYPES = ['application/activity+json', 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"'].freeze
|
||||
|
||||
def quote_from_tags
|
||||
return @quote_from_tags if defined?(@quote_from_tags)
|
||||
|
||||
hit_tag = as_array(@object['tag']).detect do |tag|
|
||||
equals_or_includes?(tag['type'], 'Link') && LINK_MEDIA_TYPES.include?(tag['mediaType']) && tag['href'].present?
|
||||
end
|
||||
@quote_from_tags = hit_tag && hit_tag['href']
|
||||
end
|
||||
|
||||
def join_group!
|
||||
|
|
|
@ -140,7 +140,19 @@ class ActivityPub::NoteSerializer < ActivityPub::Serializer
|
|||
end
|
||||
|
||||
def virtual_tags
|
||||
object.active_mentions.to_a.sort_by(&:id) + object.tags + object.emojis
|
||||
object.active_mentions.to_a.sort_by(&:id) + object.tags + object.emojis + virtual_tags_of_quote
|
||||
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,
|
||||
},
|
||||
]
|
||||
end
|
||||
|
||||
def atom_uri
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue