diff --git a/web/src/components/object.rs b/web/src/components/object.rs index 4fcb38c1..3073ff7a 100644 --- a/web/src/components/object.rs +++ b/web/src/components/object.rs @@ -15,12 +15,12 @@ pub fn Attachment( let (expand, set_expand) = create_signal(false); let href = object.url().id().unwrap_or_default(); let media_type = object.media_type() - .unwrap_or("image/png") // TODO weird defaulting to png????? + .unwrap_or("link") // TODO make it an Option rather than defaulting to link everywhere .to_string(); let mut kind = media_type .split('/') .next() - .unwrap_or("image") + .unwrap_or("link") .to_string(); // TODO in theory we should match on document_type, but mastodon and misskey send all attachments @@ -76,15 +76,29 @@ pub fn Attachment(

}.into_view(), + "link" => + view! { + + + {Uri::pretty(&href)} + + + {object.name().map(|name| { + view! { +

{name.to_string()}

+ } + })} + }.into_view(), + _ => view! {

{media_type} -

- {object.name().unwrap_or_default().to_string()} -

+ {object.name().map(|name| { + view! {

{name.to_string()}

} + })}

}.into_view(), } @@ -130,11 +144,14 @@ pub fn Object(object: crate::Object) -> impl IntoView {
{post_inner}
}.into_view(), // lemmy with Page, peertube with Video - Some(apb::ObjectType::Document(_)) => view! { + Some(apb::ObjectType::Document(t)) => view! {
{object.name().unwrap_or_default().to_string()}
{post_inner} + + +
}.into_view(), // wordpress, ... ?