diff options
author | Christopher Speller <crspeller@gmail.com> | 2016-02-04 14:50:30 -0500 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2016-02-04 14:50:30 -0500 |
commit | ec51c31c325b3dc648a261f0e8634b6d70d7ba73 (patch) | |
tree | 1369b8d2bc406d54770d7ccf52b1e6a8bfedfc05 /web/react/components/post_info.jsx | |
parent | 44c19ee443831e0e94b5738ecb21a64ce7643247 (diff) | |
parent | 21318b7505babaebbb5174c62b75595b2936ebe0 (diff) | |
download | chat-ec51c31c325b3dc648a261f0e8634b6d70d7ba73.tar.gz chat-ec51c31c325b3dc648a261f0e8634b6d70d7ba73.tar.bz2 chat-ec51c31c325b3dc648a261f0e8634b6d70d7ba73.zip |
Merge pull request #2064 from hmhealey/plt882
PLT-882 Ephemeral Messages and Out-Of-Channel mentions
Diffstat (limited to 'web/react/components/post_info.jsx')
-rw-r--r-- | web/react/components/post_info.jsx | 25 |
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..b1bc8ca14 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 || Utils.isPostEphemeral(post)) { 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 (!Utils.isPostEphemeral(post)) { + 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 && !Utils.isPostEphemeral(post)) { comments = ( <a href='#' @@ -264,6 +284,7 @@ export default class PostInfo extends React.Component { > {permalinkOverlay} </Overlay> + {this.createRemovePostButton(post)} </li> </ul> ); |