summaryrefslogtreecommitdiffstats
path: root/web/react/components/post_info.jsx
diff options
context:
space:
mode:
authorhmhealey <harrisonmhealey@gmail.com>2016-02-01 15:22:44 -0500
committerhmhealey <harrisonmhealey@gmail.com>2016-02-04 11:38:56 -0500
commitdb13b7a3ca3d3099392be557e47f838a7851a69a (patch)
tree65b36c76adba1112b6613e9b59f39588483c259a /web/react/components/post_info.jsx
parentb7d045844c4d00d8268da50f2388be1d12c91829 (diff)
downloadchat-db13b7a3ca3d3099392be557e47f838a7851a69a.tar.gz
chat-db13b7a3ca3d3099392be557e47f838a7851a69a.tar.bz2
chat-db13b7a3ca3d3099392be557e47f838a7851a69a.zip
Changed deleted posts to be more general ephemeral posts
Diffstat (limited to 'web/react/components/post_info.jsx')
-rw-r--r--web/react/components/post_info.jsx25
1 files changed, 23 insertions, 2 deletions
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>
);