summaryrefslogtreecommitdiffstats
path: root/webapp/components/rhs_root_post.jsx
diff options
context:
space:
mode:
Diffstat (limited to 'webapp/components/rhs_root_post.jsx')
-rw-r--r--webapp/components/rhs_root_post.jsx97
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'