1
0
Fork 0
forked from alemi/upub

feat: show replies collection inline with object

This commit is contained in:
əlemi 2024-04-19 04:04:19 +02:00
parent 13533a58d9
commit 973a3060ac
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -1,4 +1,4 @@
use apb::{BaseMut, ObjectMut};
use apb::{BaseMut, CollectionMut, ObjectMut};
use sea_orm::entity::prelude::*;
use crate::routes::activitypub::jsonld::LD;
@ -59,6 +59,13 @@ impl Model {
.set_content(self.content.as_deref())
.set_context(apb::Node::maybe_link(self.context.clone()))
.set_in_reply_to(apb::Node::maybe_link(self.in_reply_to.clone()))
.set_replies(apb::Node::object(
serde_json::Value::new_object()
.set_id(Some(&format!("{}/replies", self.id)))
.set_collection_type(Some(apb::CollectionType::OrderedCollection))
.set_first(apb::Node::link(format!("{}/replies/page", self.id)))
.set_total_items(Some(self.comments as u64))
))
.set_published(Some(self.published))
.set_to(apb::Node::links(self.to.0.clone()))
.set_bto(apb::Node::Empty)