From 5a3bc43668353e41949d2d48c8956eaa9d061860 Mon Sep 17 00:00:00 2001 From: George Goldberg Date: Tue, 28 Feb 2017 21:28:37 +0000 Subject: PLT-5188: Reinstate delete option on system messages. (#5113) * PLT-5188: Reinstate delete option on system messages. * Fix styling. * Fix empty hover box. --- .../components/post_view/components/post_info.jsx | 68 ++++++++++++---------- 1 file changed, 37 insertions(+), 31 deletions(-) (limited to 'webapp/components') diff --git a/webapp/components/post_view/components/post_info.jsx b/webapp/components/post_view/components/post_info.jsx index e368e65f4..331fdeb00 100644 --- a/webapp/components/post_view/components/post_info.jsx +++ b/webapp/components/post_view/components/post_info.jsx @@ -53,10 +53,8 @@ export default class PostInfo extends React.Component { } createDropdown() { - var post = this.props.post; - - this.canDelete = PostUtils.canDeletePost(post); - this.canEdit = PostUtils.canEditPost(post, this.editDisableAction); + const post = this.props.post; + const isSystemMessage = PostUtils.isSystemMessage(post); if (post.state === Constants.POST_FAILED || post.state === Constants.POST_LOADING) { return ''; @@ -131,22 +129,24 @@ export default class PostInfo extends React.Component { } } - dropdownContents.push( -
  • - - - -
  • - ); + + + + + ); + } if (this.canDelete) { dropdownContents.push( @@ -267,6 +267,9 @@ export default class PostInfo extends React.Component { var commentCountText = this.props.commentCount; const flagIcon = Constants.FLAG_ICON_SVG; + this.canDelete = PostUtils.canDeletePost(post); + this.canEdit = PostUtils.canEditPost(post, this.editDisableAction); + if (this.props.commentCount >= 1) { showCommentClass = ' icon--show'; } else { @@ -296,18 +299,21 @@ export default class PostInfo extends React.Component { {this.createRemovePostButton()} ); - } else if (!PostUtils.isSystemMessage(post)) { - options = ( -
  • -
    - {this.createDropdown()} -
    - {comments} -
  • - ); + } else { + const dropdown = this.createDropdown(); + if (dropdown) { + options = ( +
  • +
    + {dropdown} +
    + {comments} +
  • + ); + } } let flag; -- cgit v1.2.3-1-g7c22