diff --git a/web/src/components/timeline.rs b/web/src/components/timeline.rs index 91b592a8..a47a12b4 100644 --- a/web/src/components/timeline.rs +++ b/web/src/components/timeline.rs @@ -84,29 +84,36 @@ pub fn TimelineRepliesRecursive(tl: Timeline, root: String) -> impl IntoView { .get() .into_iter() .filter_map(|x| CACHE.get(&x)) - .filter(|x| match x.object_type() { - Ok(apb::ObjectType::Activity(apb::ActivityType::Create)) => { - let Some(oid) = x.object().id().str() else { return false; }; - let Some(object) = CACHE.get(&oid) else { return false; }; - let Some(reply) = object.in_reply_to().id().str() else { return false; }; - reply == root - }, - Ok(apb::ObjectType::Activity(_)) => x.object().id().map(|o| o == root).unwrap_or(false), - _ => x.in_reply_to().id().map(|r| r == root).unwrap_or(false), + .filter_map(|x| { + let oid = match x.object_type().ok()? { + // if it's a create, get and check created object: does it reply to root? + apb::ObjectType::Activity(apb::ActivityType::Create) => + CACHE.get(x.object().id().ok()?)?.in_reply_to().id().str()?, + + // if it's a raw note, directly check if it replies to root + apb::ObjectType::Note => x.in_reply_to().id().str()?, + + // if it's anything else, check if it relates to root, maybe like or announce? + _ => x.object().id().str()?, + }; + if oid == root { + Some((oid, x)) + } else { + None + } }) - .collect::>(); + .collect::>(); view! {
- +
}