From 968bd6f0ee9c8ae4dbb84a2e1bad6250bf394068 Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Sun, 25 Dec 2022 02:16:28 +0000 Subject: [PATCH] activitypub: resolve quoted objects when new create activities are received --- app/lib/activitypub/activity/create.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/lib/activitypub/activity/create.rb b/app/lib/activitypub/activity/create.rb index ebae129732..0dc315c53b 100644 --- a/app/lib/activitypub/activity/create.rb +++ b/app/lib/activitypub/activity/create.rb @@ -126,6 +126,7 @@ class ActivityPub::Activity::Create < ActivityPub::Activity conversation: conversation_from_uri(@object['conversation']), media_attachment_ids: process_attachments.take(4).map(&:id), poll: process_poll, + quote: quote_from_url(@object['quoteUrl']), } end end @@ -426,4 +427,11 @@ class ActivityPub::Activity::Create < ActivityPub::Activity poll.reload retry 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