From: Dessalines <tyhou13@gmx.com>
Date: Thu, 25 Mar 2021 17:28:47 +0000 (-0400)
Subject: Adding cross-post quote and link. Fixes #189
X-Git-Url: http://these/git/%7B%60%24%7BghostArchiveUrl%7D/README.zh.hant.md?a=commitdiff_plain;h=d8346d9e95a67595a2888bfc90b81297a1b4048a;p=lemmy-ui.git

Adding cross-post quote and link. Fixes #189
---

diff --git a/lemmy-translations b/lemmy-translations
index ebb1c59..4a6036f 160000
--- a/lemmy-translations
+++ b/lemmy-translations
@@ -1 +1 @@
-Subproject commit ebb1c594cd6ae91fa65c7f305c61f318eb10125f
+Subproject commit 4a6036fce9515e43fcd1885f510330b13bb2e9bc
diff --git a/src/shared/components/post-listing.tsx b/src/shared/components/post-listing.tsx
index c10a8dd..32a176a 100644
--- a/src/shared/components/post-listing.tsx
+++ b/src/shared/components/post-listing.tsx
@@ -1284,11 +1284,19 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
       params += `&url=${encodeURIComponent(post.url)}`;
     }
     if (post.body) {
-      params += `&body=${encodeURIComponent(post.body)}`;
+      params += `&body=${encodeURIComponent(this.crossPostBody())}`;
     }
     return params;
   }
 
+  crossPostBody(): string {
+    let post = this.props.post_view.post;
+    let body = `${i18n.t("cross_posted_from")} ${
+      post.ap_id
+    }\n\n---\n\n${post.body.replace(/^/gm, "> ")}`;
+    return body;
+  }
+
   get showBody(): boolean {
     return this.props.showBody || this.state.showBody;
   }