{
@@ -256,7 +279,7 @@ export default class Post extends React.Component {
>
{profilePicContainer}
@@ -265,7 +288,7 @@ export default class Post extends React.Component {
ref='header'
post={post}
sameRoot={this.props.sameRoot}
- commentCount={commentCount}
+ commentCount={this.props.commentCount}
handleCommentClick={this.handleCommentClick}
handleDropdownOpened={this.handleDropdownOpened}
isLastComment={this.props.isLastComment}
@@ -298,27 +321,3 @@ export default class Post extends React.Component {
);
}
}
-
-Post.propTypes = {
- post: React.PropTypes.object.isRequired,
- parentPost: React.PropTypes.object,
- user: React.PropTypes.object,
- sameUser: React.PropTypes.bool,
- sameRoot: React.PropTypes.bool,
- hideProfilePic: React.PropTypes.bool,
- isLastPost: React.PropTypes.bool,
- isLastComment: React.PropTypes.bool,
- shouldHighlight: React.PropTypes.bool,
- displayNameType: React.PropTypes.string,
- currentUser: React.PropTypes.object.isRequired,
- center: React.PropTypes.bool,
- compactDisplay: React.PropTypes.bool,
- previewCollapsed: React.PropTypes.string,
- commentCount: React.PropTypes.number,
- isCommentMention: React.PropTypes.bool,
- useMilitaryTime: React.PropTypes.bool.isRequired,
- isFlagged: React.PropTypes.bool,
- status: React.PropTypes.string,
- isBusy: React.PropTypes.bool,
- childComponentDidUpdateFunction: React.PropTypes.func
-};
diff --git a/webapp/components/rhs_comment.jsx b/webapp/components/rhs_comment.jsx
index e7d55813d0..fb09728043 100644
--- a/webapp/components/rhs_comment.jsx
+++ b/webapp/components/rhs_comment.jsx
@@ -360,6 +360,28 @@ export default class RhsComment extends React.Component {
addReaction(this.props.post.channel_id, this.props.post.id, emojiName);
}
+ getClassName = (post, isSystemMessage) => {
+ let className = 'post post--thread';
+
+ if (this.props.currentUser.id === post.user_id) {
+ className += ' current--user';
+ }
+
+ if (isSystemMessage) {
+ className += ' post--system';
+ }
+
+ if (this.props.compactDisplay) {
+ className += 'post--compact';
+ }
+
+ if (post.is_pinned) {
+ className += ' post--pinned';
+ }
+
+ return className;
+ }
+
render() {
const post = this.props.post;
const flagIcon = Constants.FLAG_ICON_SVG;
@@ -369,11 +391,6 @@ export default class RhsComment extends React.Component {
const isPending = post.state === Constants.POST_FAILED || post.state === Constants.POST_LOADING;
const isSystemMessage = PostUtils.isSystemMessage(post);
- var currentUserCss = '';
- if (this.props.currentUser.id === post.user_id) {
- currentUserCss = 'current--user';
- }
-
var timestamp = this.props.currentUser.last_picture_update;
let status = this.props.status;
@@ -445,11 +462,6 @@ export default class RhsComment extends React.Component {
postClass += ' post--edited';
}
- let systemMessageClass = '';
- if (isSystemMessage) {
- systemMessageClass = 'post--system';
- }
-
let profilePic = (
{profilePicContainer}
diff --git a/webapp/components/rhs_root_post.jsx b/webapp/components/rhs_root_post.jsx
index 023387bb42..65bc52f730 100644
--- a/webapp/components/rhs_root_post.jsx
+++ b/webapp/components/rhs_root_post.jsx
@@ -176,6 +176,27 @@ export default class RhsRootPost extends React.Component {
addReaction(this.props.post.channel_id, this.props.post.id, emojiName);
}
+ getClassName = (post, isSystemMessage) => {
+ let className = 'post post--root post--thread';
+ if (UserStore.getCurrentId() === post.user_id) {
+ className += ' current--user';
+ }
+
+ if (isSystemMessage) {
+ className += ' post--system';
+ }
+
+ if (this.props.compactDisplay) {
+ className += 'post--compact';
+ }
+
+ if (post.is_pinned) {
+ className += ' post--pinned';
+ }
+
+ return className;
+ }
+
render() {
const post = this.props.post;
const user = this.props.user;
@@ -196,16 +217,6 @@ export default class RhsRootPost extends React.Component {
type = 'Comment';
}
- var userCss = '';
- if (UserStore.getCurrentId() === post.user_id) {
- userCss = 'current--user';
- }
-
- var systemMessageClass = '';
- if (isSystemMessage) {
- systemMessageClass = 'post--system';
- }
-
var channelName;
if (channel) {
if (channel.type === 'D') {
@@ -493,11 +504,7 @@ export default class RhsRootPost extends React.Component {
);
}
- let compactClass = '';
- let postClass = '';
if (this.props.compactDisplay) {
- compactClass = 'post--compact';
-
if (post.props && post.props.from_webhook) {
profilePic = (
{channelName}