fix(web): show all activities in thread, alt texts

This commit is contained in:
əlemi 2024-04-22 02:10:27 +02:00
parent b6f10e9cc1
commit ecaecd3b65
Signed by: alemi
GPG key ID: A4895B84D311642C
2 changed files with 16 additions and 9 deletions

View file

@ -13,7 +13,7 @@ pub fn Object(object: serde_json::Value) -> impl IntoView {
let author = CACHE.get_or(&author_id, serde_json::Value::String(author_id.clone())); let author = CACHE.get_or(&author_id, serde_json::Value::String(author_id.clone()));
let attachments = object.attachment() let attachments = object.attachment()
.map(|x| view! { .map(|x| view! {
<p><img class="attachment" src={x.url().id().unwrap_or_default()} /></p> <p class="center"><img class="attachment" src={x.url().id().unwrap_or_default()} title={x.name().unwrap_or_default().to_string()} /></p>
}) })
.collect_view(); .collect_view();
view! { view! {

View file

@ -51,8 +51,8 @@ pub fn TimelineRepliesRecursive(tl: Timeline, root: String) -> impl IntoView {
.into_iter() .into_iter()
.filter_map(|x| CACHE.get(&x)) .filter_map(|x| CACHE.get(&x))
.filter(|x| match x.object_type() { .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)) 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),
.unwrap_or_else(|| x.object().id().map(|i| i == root).unwrap_or(false)), 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), _ => x.in_reply_to().id().map(|r| r == root).unwrap_or(false),
}) })
.collect::<Vec<serde_json::Value>>(); .collect::<Vec<serde_json::Value>>();
@ -62,12 +62,19 @@ pub fn TimelineRepliesRecursive(tl: Timeline, root: String) -> impl IntoView {
each=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(); match object.object_type() {
view! { Some(apb::ObjectType::Activity(_)) => view! {
<Object object=object /> <ActivityLine activity=object />
<div class="ml-1"> }.into_view(),
<TimelineRepliesRecursive tl=tl root=oid /> _ => {
</div> let oid = object.id().unwrap_or_default().to_string();
view! {
<Object object=object />
<div class="ml-1">
<TimelineRepliesRecursive tl=tl root=oid />
</div>
}.into_view()
},
} }
} }
/ > / >