From db13b7a3ca3d3099392be557e47f838a7851a69a Mon Sep 17 00:00:00 2001
From: hmhealey <harrisonmhealey@gmail.com>
Date: Mon, 1 Feb 2016 15:22:44 -0500
Subject: Changed deleted posts to be more general ephemeral posts

---
 web/react/components/post_info.jsx | 25 +++++++++++++++++++++++--
 1 file changed, 23 insertions(+), 2 deletions(-)

(limited to 'web/react/components/post_info.jsx')

diff --git a/web/react/components/post_info.jsx b/web/react/components/post_info.jsx
index ddb393520..02150bd9d 100644
--- a/web/react/components/post_info.jsx
+++ b/web/react/components/post_info.jsx
@@ -23,13 +23,14 @@ export default class PostInfo extends React.Component {
         };
 
         this.handlePermalinkCopy = this.handlePermalinkCopy.bind(this);
+        this.removePost = this.removePost.bind(this);
     }
     createDropdown() {
         var post = this.props.post;
         var isOwner = UserStore.getCurrentId() === post.user_id;
         var isAdmin = Utils.isAdmin(UserStore.getCurrentUser().roles);
 
-        if (post.state === Constants.POST_FAILED || post.state === Constants.POST_LOADING || post.state === Constants.POST_DELETED) {
+        if (post.state === Constants.POST_FAILED || post.state === Constants.POST_LOADING || post.ephemeral) {
             return '';
         }
 
@@ -166,6 +167,25 @@ export default class PostInfo extends React.Component {
             this.setState({copiedLink: false});
         }
     }
+    removePost() {
+        EventHelpers.emitRemovePost(this.props.post);
+    }
+    createRemovePostButton(post) {
+        if (!post.ephemeral) {
+            return null;
+        }
+
+        return (
+            <a
+                href='#'
+                className='post__remove theme'
+                type='button'
+                onClick={this.removePost}
+            >
+                {'×'}
+            </a>
+        );
+    }
     render() {
         var post = this.props.post;
         var comments = '';
@@ -178,7 +198,7 @@ export default class PostInfo extends React.Component {
             commentCountText = '';
         }
 
-        if (post.state !== Constants.POST_FAILED && post.state !== Constants.POST_LOADING && post.state !== Constants.POST_DELETED) {
+        if (post.state !== Constants.POST_FAILED && post.state !== Constants.POST_LOADING && !post.ephemeral) {
             comments = (
                 <a
                     href='#'
@@ -264,6 +284,7 @@ export default class PostInfo extends React.Component {
                     >
                         {permalinkOverlay}
                     </Overlay>
+                    {this.createRemovePostButton(post)}
                 </li>
             </ul>
         );
-- 
cgit v1.2.3-1-g7c22

