activitypub: resolve quoted objects when new create activities are received

feature/quote
Ariadne Conill 2022-12-25 02:16:28 +00:00
parent 6b07407820
commit 968bd6f0ee
1 changed files with 8 additions and 0 deletions

View File

@ -126,6 +126,7 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
conversation: conversation_from_uri(@object['conversation']), conversation: conversation_from_uri(@object['conversation']),
media_attachment_ids: process_attachments.take(4).map(&:id), media_attachment_ids: process_attachments.take(4).map(&:id),
poll: process_poll, poll: process_poll,
quote: quote_from_url(@object['quoteUrl']),
} }
end end
end end
@ -426,4 +427,11 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
poll.reload poll.reload
retry retry
end end
def quote_from_url(url)
return nil if url.nil?
quote = ResolveURLService.new.call(url)
status_from_uri(quote.uri) if quote
end
end end