1
0
Fork 0
forked from alemi/upub

feat: parse object comments count from replies

This commit is contained in:
əlemi 2024-04-20 04:26:31 +02:00
parent 1ca97668a1
commit f3dcbffeca
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -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(),