fix(web): thread view shows all types of objects

This commit is contained in:
əlemi 2024-04-22 01:44:00 +02:00
parent dfec715594
commit 4997be5a72
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -50,18 +50,24 @@ pub fn TimelineRepliesRecursive(tl: Timeline, root: String) -> impl IntoView {
.get() .get()
.into_iter() .into_iter()
.filter_map(|x| CACHE.get(&x)) .filter_map(|x| CACHE.get(&x))
.filter(|x| x.object().get().map(|o| o.in_reply_to().id().map(|r| r == root).unwrap_or(false)).unwrap_or(false)) .filter(|x| match x.object_type() {
Some(apb::ObjectType::Activity(_)) => x.object().get().map(|o| o.in_reply_to().id().map(|r| r == root).unwrap_or(false))
.unwrap_or_else(|| x.object().id().map(|i| i == root).unwrap_or(false)),
_ => x.in_reply_to().id().map(|r| r == root).unwrap_or(false),
})
.collect::<Vec<serde_json::Value>>(); .collect::<Vec<serde_json::Value>>();
view! { view! {
<For <For
each=move || root_values() each=root_values
key=|k| k.id().unwrap_or_default().to_string() key=|k| k.id().unwrap_or_default().to_string()
children=move |object: serde_json::Value| { children=move |object: serde_json::Value| {
let oid = object.id().unwrap_or_default().to_string(); let oid = object.id().unwrap_or_default().to_string();
view! { view! {
<Object object=object /> <Object object=object />
<TimelineRepliesRecursive tl=tl root=oid /> <div class="ml-1">
<TimelineRepliesRecursive tl=tl root=oid />
</div>
} }
} }
/ > / >