]> Untitled Git - lemmy.git/commitdiff
cross-posting almost done.
authorDessalines <tyhou13@gmx.com>
Thu, 22 Aug 2019 18:46:54 +0000 (11:46 -0700)
committerDessalines <tyhou13@gmx.com>
Thu, 22 Aug 2019 18:46:54 +0000 (11:46 -0700)
ui/src/components/post-listing.tsx
ui/src/translations/en.ts

index bb6f2cece04bd7350895fa026799c0efb013e889..f67a0fc7073b27f4f9c66beedde4bc2b3087a7bf 100644 (file)
@@ -150,6 +150,9 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
               <li className="list-inline-item mr-2">
                 <span class="pointer" onClick={linkEvent(this, this.handleSavePostClick)}>{post.saved ? i18n.t('unsave') : i18n.t('save')}</span>
               </li>
+              <li className="list-inline-item mr-2">
+                <span class="pointer" onClick={linkEvent(this, this.handleCrossPostClick)}><T i18nKey="cross_post">#</T></span>
+              </li>
               {this.myPost && 
                 <>
                   <li className="list-inline-item">
@@ -270,6 +273,17 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
     WebSocketService.Instance.savePost(form);
   }
 
+  handleCrossPostClick(i: PostListing) { 
+    let params = `?name=${i.props.post.name}`;
+    if (i.props.post.url) {
+      params += `&url=${i.props.post.url}`;
+    }
+    if (i.props.post.body) {
+      params += `&body=${i.props.post.body}`;
+    }
+    i.context.router.history.push(`/create_post${params}`);
+  }
+
   handleModRemoveShow(i: PostListing) {
     i.state.showRemoveDialog = true;
     i.setState(i.state);
index 90497ada59833ff061fc6fe84f5e776008e9db3d..94e06d02d66d39da921eec9cc874deac73ffb47e 100644 (file)
@@ -9,6 +9,7 @@ export const en = {
     posts: 'Posts',
     related_posts: 'These posts might be related',
     cross_posts: 'This link has also been posted to:',
+    cross_post: 'cross-post',
     comments: 'Comments',
     number_of_comments:'{{count}} Comments',
     remove_comment: 'Remove Comment',