summaryrefslogtreecommitdiffstats
path: root/webapp/components/post_header.jsx
diff options
context:
space:
mode:
author=Corey Hulen <corey@hulen.com>2016-03-16 18:13:16 -0700
committer=Corey Hulen <corey@hulen.com>2016-03-16 18:13:16 -0700
commitb9d5b4e5dcc1585397f1e1d2e53c5f040ee76220 (patch)
tree85d2c293aa3456182a754fefe6646162b516eb6c /webapp/components/post_header.jsx
parente101b2cf7c172d1c4ff20e0df63917b5b8f923ed (diff)
parentcba59d4eb6ef0f65304bc72339c676ebfd653e2b (diff)
downloadchat-b9d5b4e5dcc1585397f1e1d2e53c5f040ee76220.tar.gz
chat-b9d5b4e5dcc1585397f1e1d2e53c5f040ee76220.tar.bz2
chat-b9d5b4e5dcc1585397f1e1d2e53c5f040ee76220.zip
merging files
Diffstat (limited to 'webapp/components/post_header.jsx')
-rw-r--r--webapp/components/post_header.jsx80
1 files changed, 80 insertions, 0 deletions
diff --git a/webapp/components/post_header.jsx b/webapp/components/post_header.jsx
new file mode 100644
index 000000000..9161d37f9
--- /dev/null
+++ b/webapp/components/post_header.jsx
@@ -0,0 +1,80 @@
+// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
+// See License.txt for license information.
+
+import UserProfile from './user_profile.jsx';
+import PostInfo from './post_info.jsx';
+import * as Utils from 'utils/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;
+
+ let userProfile = <UserProfile user={this.props.user}/>;
+ let botIndicator;
+
+ if (post.props && post.props.from_webhook) {
+ if (post.props.override_username && global.window.mm_config.EnablePostUsernameOverride === 'true') {
+ userProfile = (
+ <UserProfile
+ user={this.props.user}
+ overwriteName={post.props.override_username}
+ disablePopover={true}
+ />
+ );
+ }
+
+ botIndicator = <li className='col col__name bot-indicator'>{'BOT'}</li>;
+ } else if (Utils.isSystemMessage(post)) {
+ userProfile = (
+ <UserProfile
+ user={{}}
+ overwriteName={Constants.SYSTEM_MESSAGE_PROFILE_NAME}
+ overwriteImage={Constants.SYSTEM_MESSAGE_PROFILE_IMAGE}
+ disablePopover={true}
+ />
+ );
+ }
+
+ return (
+ <ul className='post__header'>
+ <li className='col col__name'>{userProfile}</li>
+ {botIndicator}
+ <li className='col'>
+ <PostInfo
+ post={post}
+ commentCount={this.props.commentCount}
+ handleCommentClick={this.props.handleCommentClick}
+ allowReply='true'
+ isLastComment={this.props.isLastComment}
+ sameUser={this.props.sameUser}
+ currentUser={this.props.currentUser}
+ />
+ </li>
+ </ul>
+ );
+ }
+}
+
+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,
+ isLastComment: React.PropTypes.bool.isRequired,
+ handleCommentClick: React.PropTypes.func.isRequired,
+ sameUser: React.PropTypes.bool.isRequired
+};