From 6dc7ea6ab267b18193a9a5a034d0762a7b1cce6c Mon Sep 17 00:00:00 2001 From: enahum Date: Thu, 28 Jul 2016 13:38:15 -0400 Subject: PLT-3553 Fix System messages show an empty box (#3689) --- .../components/post_view/components/post_body.jsx | 13 ------ .../components/post_view/components/post_info.jsx | 49 +++++++++++++++++----- 2 files changed, 39 insertions(+), 23 deletions(-) (limited to 'webapp/components/post_view') diff --git a/webapp/components/post_view/components/post_body.jsx b/webapp/components/post_view/components/post_body.jsx index a98c92017..348e7fc93 100644 --- a/webapp/components/post_view/components/post_body.jsx +++ b/webapp/components/post_view/components/post_body.jsx @@ -154,26 +154,13 @@ export default class PostBody extends React.Component { } let message; - let removeButton; if (this.props.post.state === Constants.POST_DELETED) { - removeButton = ( - - {'×'} - - ); - message = (

- {removeButton}

); } else { diff --git a/webapp/components/post_view/components/post_info.jsx b/webapp/components/post_view/components/post_info.jsx index 98639529e..9cb1e751d 100644 --- a/webapp/components/post_view/components/post_info.jsx +++ b/webapp/components/post_view/components/post_info.jsx @@ -20,6 +20,7 @@ export default class PostInfo extends React.Component { this.handleDropdownClick = this.handleDropdownClick.bind(this); this.handlePermalink = this.handlePermalink.bind(this); + this.removePost = this.removePost.bind(this); } handleDropdownClick(e) { var position = $('#post-list').height() - $(e.target).offset().top; @@ -170,6 +171,23 @@ export default class PostInfo extends React.Component { GlobalActions.showGetPostLinkModal(this.props.post); } + removePost() { + GlobalActions.emitRemovePost(this.props.post); + } + + createRemovePostButton() { + return ( + + {'×'} + + ); + } + render() { var post = this.props.post; var comments = ''; @@ -203,7 +221,26 @@ export default class PostInfo extends React.Component { ); } - var dropdown = this.createDropdown(); + let options; + if (Utils.isPostEphemeral(post)) { + options = ( +
  • + {this.createRemovePostButton()} +
  • + ); + } else { + options = ( +
  • +
    + {this.createDropdown()} +
    + {comments} +
  • + ); + } return ( ); } -- cgit v1.2.3-1-g7c22