diff options
author | Colin Reeder <vpzomtrrfrt@gmail.com> | 2020-10-09 21:36:58 -0600 |
---|---|---|
committer | Colin Reeder <vpzomtrrfrt@gmail.com> | 2020-10-09 21:36:58 -0600 |
commit | 2f611bb510bed317481e41bbeebb412aee849d06 (patch) | |
tree | b4c9550430352343259b4cd56aa2343329718fcf | |
parent | d9f0d1b3e1085c21f19e426d0399d9892318c687 (diff) |
Use a Note with attachment for image posts
-rw-r--r-- | src/apub_util.rs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/apub_util.rs b/src/apub_util.rs index d4c58b8..37f9ce2 100644 --- a/src/apub_util.rs +++ b/src/apub_util.rs @@ -1025,7 +1025,10 @@ pub fn post_to_ap( match post.href { Some(href) => { if href.starts_with("local-media://") { - let mut post_ap = activitystreams::object::Image::new(); + let mut attachment = activitystreams::object::Image::new(); + attachment.set_url(ctx.process_href(href, post.id).into_owned()); + + let mut post_ap = activitystreams::object::Note::new(); post_ap .set_context(activitystreams::context()) @@ -1034,11 +1037,11 @@ pub fn post_to_ap( post.author.unwrap(), &ctx.host_url_apub, )) - .set_url(ctx.process_href(href, post.id).into_owned()) .set_summary(post.title) .set_published(*post.created) .set_to(community_ap_id) - .set_cc(activitystreams::public()); + .set_cc(activitystreams::public()) + .add_attachment(attachment.into_any_base()?); let mut post_ap = activitystreams::object::ApObject::new(post_ap); |