From 7fdf1e7400fa9ffb2efaee65417768c0510cd0a9 Mon Sep 17 00:00:00 2001 From: silverpill Date: Sat, 1 Oct 2022 21:14:05 +0000 Subject: [PATCH] Add quoteUrl property to outgoing notes with object links --- src/activitypub/builders/create_note.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/activitypub/builders/create_note.rs b/src/activitypub/builders/create_note.rs index 478c885..5bc4767 100644 --- a/src/activitypub/builders/create_note.rs +++ b/src/activitypub/builders/create_note.rs @@ -52,6 +52,9 @@ pub struct Note { pub to: Vec, pub cc: Vec, + + #[serde(skip_serializing_if = "Option::is_none")] + quote_url: Option, } pub fn build_note( @@ -129,6 +132,8 @@ pub fn build_note( }; tags.push(tag); }; + let maybe_quote_url = post.linked.get(0) + .map(|linked| linked.get_object_id(instance_url)); let in_reply_to_object_id = match post.in_reply_to_id { Some(in_reply_to_id) => { let in_reply_to = post.in_reply_to.as_ref().unwrap(); @@ -153,6 +158,7 @@ pub fn build_note( tag: tags, to: primary_audience, cc: secondary_audience, + quote_url: maybe_quote_url, } }