// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import UserProfile from 'components/user_profile.jsx';
import PostInfo from './post_info.jsx';
import * as PostUtils from 'utils/post_utils.jsx';
import Constants from 'utils/constants.jsx';
import React from 'react';
export default class PostHeader extends React.Component {
constructor(props) {
super(props);
this.state = {};
}
render() {
const post = this.props.post;
const isSystemMessage = PostUtils.isSystemMessage(post);
let userProfile = (
);
let botIndicator;
let colon;
if (post.props && post.props.from_webhook) {
if (post.props.override_username && global.window.mm_config.EnablePostUsernameOverride === 'true') {
userProfile = (
);
}
botIndicator =
{Constants.BOT_NAME};
} else if (isSystemMessage) {
userProfile = (
);
}
if (this.props.compactDisplay) {
colon = ({':'});
}
return (
- {userProfile}{colon}
{botIndicator}
-
);
}
}
PostHeader.defaultProps = {
post: null,
commentCount: 0,
isLastComment: false,
sameUser: false
};
PostHeader.propTypes = {
post: React.PropTypes.object.isRequired,
user: React.PropTypes.object,
currentUser: React.PropTypes.object.isRequired,
commentCount: React.PropTypes.number.isRequired,
isCommentMention: React.PropTypes.bool.isRequired,
isLastComment: React.PropTypes.bool.isRequired,
handleCommentClick: React.PropTypes.func.isRequired,
handleDropdownOpened: React.PropTypes.func.isRequired,
sameUser: React.PropTypes.bool.isRequired,
compactDisplay: React.PropTypes.bool,
displayNameType: React.PropTypes.string,
useMilitaryTime: React.PropTypes.bool.isRequired,
isFlagged: React.PropTypes.bool.isRequired
};