1
0
Fork 0
forked from alemi/upub

fix(web): show stray objects too

This commit is contained in:
əlemi 2024-04-24 04:07:45 +02:00
parent 768081c251
commit 66f36ce71b
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -138,8 +138,14 @@ pub fn TimelineFeed(tl: Timeline) -> impl IntoView {
key=|k| k.to_string() key=|k| k.to_string()
children=move |id: String| { children=move |id: String| {
match CACHE.get(&id) { match CACHE.get(&id) {
Some(item) => match item.base_type() { Some(item) => match item.object_type() {
Some(apb::BaseType::Object(apb::ObjectType::Activity(_))) => { // special case for placeholder activities
Some(apb::ObjectType::Note) => view! {
<Object object=item.clone() />
<hr/ >
}.into_view(),
// everything else
Some(apb::ObjectType::Activity(_)) => {
let object_id = item.object().id().unwrap_or_default(); let object_id = item.object().id().unwrap_or_default();
let object = CACHE.get(&object_id).map(|obj| { let object = CACHE.get(&object_id).map(|obj| {
view! { <Object object=obj /> } view! { <Object object=obj /> }
@ -150,10 +156,7 @@ pub fn TimelineFeed(tl: Timeline) -> impl IntoView {
<hr/ > <hr/ >
}.into_view() }.into_view()
}, },
Some(apb::BaseType::Object(apb::ObjectType::Note)) => view! { // should never happen
<Object object=item.clone() />
<hr/ >
}.into_view(),
_ => view! { <p><code>type not implemented</code></p><hr /> }.into_view(), _ => view! { <p><code>type not implemented</code></p><hr /> }.into_view(),
}, },
None => view! { None => view! {
@ -215,6 +218,8 @@ async fn process_activities(
activity_id.to_string(), activity_id.to_string(),
activity.clone().set_object(apb::Node::maybe_link(object_id)) activity.clone().set_object(apb::Node::maybe_link(object_id))
); );
} else if let Some(object_id) = activity.object().id() {
out.push(object_id);
} }
if let Some(uid) = activity.attributed_to().id() { if let Some(uid) = activity.attributed_to().id() {