From 9c7f3f121a4da1ea1203f4518a5316f39d29695b Mon Sep 17 00:00:00 2001 From: alemi Date: Mon, 22 Apr 2024 04:43:23 +0200 Subject: [PATCH] fix(web): proper filtering for activity replies --- web/src/components/timeline.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/web/src/components/timeline.rs b/web/src/components/timeline.rs index ac505864..d8d0a76f 100644 --- a/web/src/components/timeline.rs +++ b/web/src/components/timeline.rs @@ -51,7 +51,12 @@ pub fn TimelineRepliesRecursive(tl: Timeline, root: String) -> impl IntoView { .into_iter() .filter_map(|x| CACHE.get(&x)) .filter(|x| match x.object_type() { - Some(apb::ObjectType::Activity(apb::ActivityType::Create)) => x.object().get().map(|o| o.in_reply_to().id().map(|r| r == root).unwrap_or(false)).unwrap_or(false), + Some(apb::ObjectType::Activity(apb::ActivityType::Create)) => { + let Some(oid) = x.object().id() else { return false; }; + let Some(object) = CACHE.get(&oid) else { return false; }; + let Some(reply) = object.in_reply_to().id() else { return false; }; + reply == root + }, Some(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), })