diff options
author | Christopher Speller <crspeller@gmail.com> | 2017-04-17 15:08:56 -0400 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2017-04-17 15:08:56 -0400 |
commit | 92d8fa4aa8af170d0018baed94a8787d06297e44 (patch) | |
tree | dc5000a3584952c797c03bf4331282a5e1536848 /webapp/components/rhs_root_post.jsx | |
parent | 742bab6429aeb1b581275da3c06af99fe293baab (diff) | |
parent | 30974533941e73f102505d07badf538cfdbbf3fc (diff) | |
download | chat-92d8fa4aa8af170d0018baed94a8787d06297e44.tar.gz chat-92d8fa4aa8af170d0018baed94a8787d06297e44.tar.bz2 chat-92d8fa4aa8af170d0018baed94a8787d06297e44.zip |
Merge branch 'release-3.8'
Diffstat (limited to 'webapp/components/rhs_root_post.jsx')
-rw-r--r-- | webapp/components/rhs_root_post.jsx | 97 |
1 files changed, 48 insertions, 49 deletions
diff --git a/webapp/components/rhs_root_post.jsx b/webapp/components/rhs_root_post.jsx index 542f3af42..41dd92e91 100644 --- a/webapp/components/rhs_root_post.jsx +++ b/webapp/components/rhs_root_post.jsx @@ -182,18 +182,15 @@ export default class RhsRootPost extends React.Component { const mattermostLogo = Constants.MATTERMOST_ICON_SVG; var timestamp = user ? user.last_picture_update : 0; var channel = ChannelStore.get(post.channel_id); - let canReact = false; const flagIcon = Constants.FLAG_ICON_SVG; - if (post.state !== Constants.POST_FAILED && - post.state !== Constants.POST_LOADING && - !Utils.isPostEphemeral(post) && - Utils.isFeatureEnabled(Constants.PRE_RELEASE_FEATURES.EMOJI_PICKER_PREVIEW)) { - canReact = true; - } this.canDelete = PostUtils.canDeletePost(post); this.canEdit = PostUtils.canEditPost(post, this.editDisableAction); + const isEphemeral = Utils.isPostEphemeral(post); + const isPending = post.state === Constants.POST_FAILED || post.state === Constants.POST_LOADING; + const isSystemMessage = PostUtils.isSystemMessage(post); + var type = 'Post'; if (post.root_id.length > 0) { type = 'Comment'; @@ -205,7 +202,7 @@ export default class RhsRootPost extends React.Component { } var systemMessageClass = ''; - if (PostUtils.isSystemMessage(post)) { + if (isSystemMessage) { systemMessageClass = 'post--system'; } @@ -226,7 +223,7 @@ export default class RhsRootPost extends React.Component { let react; let reactOverlay; - if (canReact) { + if (!isEphemeral && !isPending && !isSystemMessage && Utils.isFeatureEnabled(Constants.PRE_RELEASE_FEATURES.EMOJI_PICKER_PREVIEW)) { react = ( <span> <a @@ -298,57 +295,59 @@ export default class RhsRootPost extends React.Component { } } - dropdownContents.push( - <li - key='rhs-root-permalink' - role='presentation' - > - <a - href='#' - onClick={this.handlePermalink} - > - <FormattedMessage - id='rhs_root.permalink' - defaultMessage='Permalink' - /> - </a> - </li> - ); - - if (post.is_pinned) { + if (!isSystemMessage) { dropdownContents.push( <li - key='rhs-root-unpin' + key='rhs-root-permalink' role='presentation' > <a href='#' - onClick={this.unpinPost} + onClick={this.handlePermalink} > <FormattedMessage - id='rhs_root.unpin' - defaultMessage='Un-pin from channel' + id='rhs_root.permalink' + defaultMessage='Permalink' /> </a> </li> ); - } else { - dropdownContents.push( - <li - key='rhs-root-pin' - role='presentation' - > - <a - href='#' - onClick={this.pinPost} + + if (post.is_pinned) { + dropdownContents.push( + <li + key='rhs-root-unpin' + role='presentation' > - <FormattedMessage - id='rhs_root.pin' - defaultMessage='Pin to channel' - /> - </a> - </li> - ); + <a + href='#' + onClick={this.unpinPost} + > + <FormattedMessage + id='rhs_root.unpin' + defaultMessage='Un-pin from channel' + /> + </a> + </li> + ); + } else { + dropdownContents.push( + <li + key='rhs-root-pin' + role='presentation' + > + <a + href='#' + onClick={this.pinPost} + > + <FormattedMessage + id='rhs_root.pin' + defaultMessage='Pin to channel' + /> + </a> + </li> + ); + } } if (this.canDelete) { @@ -443,7 +442,7 @@ export default class RhsRootPost extends React.Component { } botIndicator = <li className='col col__name bot-indicator'>{'BOT'}</li>; - } else if (PostUtils.isSystemMessage(post)) { + } else if (isSystemMessage) { userProfile = ( <UserProfile user={{}} @@ -485,7 +484,7 @@ export default class RhsRootPost extends React.Component { ); } - if (PostUtils.isSystemMessage(post)) { + if (isSystemMessage) { profilePic = ( <span className='icon' |