From f3dcbffecae738c3b068d8deaa1bb4b5f2f5a0da Mon Sep 17 00:00:00 2001 From: alemi Date: Sat, 20 Apr 2024 04:26:31 +0200 Subject: [PATCH] feat: parse object comments count from replies --- src/model/object.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/model/object.rs b/src/model/object.rs index eeceba95..c95886e7 100644 --- a/src/model/object.rs +++ b/src/model/object.rs @@ -1,4 +1,4 @@ -use apb::{BaseMut, ObjectMut}; +use apb::{BaseMut, ObjectMut, Collection}; use sea_orm::entity::prelude::*; use crate::routes::activitypub::jsonld::LD; @@ -39,7 +39,7 @@ impl Model { context: object.context().id(), in_reply_to: object.in_reply_to().id(), published: object.published().ok_or(super::FieldError("published"))?, - comments: 0, + comments: object.replies().get().map(|x| x.total_items().unwrap_or(0)).unwrap_or(0) as i64, likes: 0, shares: 0, to: object.to().into(),