]> Untitled Git - lemmy.git/blobdiff - crates/apub/src/objects/post.rs
Mobilizon federation (#2544)
[lemmy.git] / crates / apub / src / objects / post.rs
index d6719926d0e40aea884c9e0fae88c6eb49fe48da..7d6c9e102dee41f50454ae16cf494a5b953519f4 100644 (file)
@@ -167,12 +167,9 @@ impl ApubObject for ApubPost {
     let community = page.extract_community(context, request_counter).await?;
 
     let form = if !page.is_mod_action(context).await? {
-      let url = if let Some(attachment) = page.attachment.first() {
-        Some(match attachment {
-          // url as sent by Lemmy (new)
-          Attachment::Link(link) => link.href.clone(),
-          Attachment::Image(image) => image.url.clone(),
-        })
+      let first_attachment = page.attachment.into_iter().map(|a| a.url()).next();
+      let url = if first_attachment.is_some() {
+        first_attachment
       } else if page.kind == PageType::Video {
         // we cant display videos directly, so insert a link to external video page
         Some(page.id.inner().clone())