fix: show in_reply_to and statuses count

This commit is contained in:
əlemi 2024-04-18 04:14:16 +02:00
parent a897edd310
commit 5f8d8be05a
Signed by: alemi
GPG key ID: A4895B84D311642C
2 changed files with 9 additions and 2 deletions

View file

@ -16,6 +16,7 @@ pub fn ap_object(object: model::object::Model) -> serde_json::Value {
.set_summary(object.summary.as_deref()) .set_summary(object.summary.as_deref())
.set_content(object.content.as_deref()) .set_content(object.content.as_deref())
.set_context(Node::maybe_link(object.context.clone())) .set_context(Node::maybe_link(object.context.clone()))
.set_in_reply_to(Node::maybe_link(object.in_reply_to.clone()))
.set_published(Some(object.published)) .set_published(Some(object.published))
.set_to(Node::links(object.to.0.clone())) .set_to(Node::links(object.to.0.clone()))
.set_bto(Node::Empty) .set_bto(Node::Empty)

View file

@ -61,8 +61,14 @@ pub async fn view(
// local user // local user
Some((user, Some(cfg))) => { Some((user, Some(cfg))) => {
Ok(JsonLD(ap_user(user.clone()) // ew ugly clone TODO Ok(JsonLD(ap_user(user.clone()) // ew ugly clone TODO
.set_inbox(Node::link(url!(ctx, "/users/{id}/inbox"))) .set_inbox(Node::link(url!(ctx, "/users/{id}/inbox"))) // TODO unread activities as count
.set_outbox(Node::link(url!(ctx, "/users/{id}/outbox"))) .set_outbox(Node::object(
serde_json::Value::new_object()
.set_id(Some(&url!(ctx, "/users/{id}/outbox")))
.set_collection_type(Some(apb::CollectionType::OrderedCollection))
.set_first(Node::link(url!(ctx, "/users/{id}/outbox/page")))
.set_total_items(Some(user.statuses_count as u64))
))
.set_following(Node::object( .set_following(Node::object(
serde_json::Value::new_object() serde_json::Value::new_object()
.set_id(Some(&url!(ctx, "/users/{id}/following"))) .set_id(Some(&url!(ctx, "/users/{id}/following")))