diff options
author | Harrison Healey <harrisonmhealey@gmail.com> | 2017-05-03 11:54:32 -0400 |
---|---|---|
committer | Corey Hulen <corey@hulen.com> | 2017-05-03 08:54:32 -0700 |
commit | aa65478445b79fd8fa9f5ceadd7715e8ba3a9576 (patch) | |
tree | f4d357f7a20a3e1e85be30fcee30505d768e18bb /webapp/components/rhs_root_post.jsx | |
parent | c3ed7b2540241cc9a1767f5b38bfa5b52f9d9419 (diff) | |
download | chat-aa65478445b79fd8fa9f5ceadd7715e8ba3a9576.tar.gz chat-aa65478445b79fd8fa9f5ceadd7715e8ba3a9576.tar.bz2 chat-aa65478445b79fd8fa9f5ceadd7715e8ba3a9576.zip |
PLT-6297 Added post--pinned CSS class to pinned posts (#6303)
Diffstat (limited to 'webapp/components/rhs_root_post.jsx')
-rw-r--r-- | webapp/components/rhs_root_post.jsx | 38 |
1 files changed, 23 insertions, 15 deletions
diff --git a/webapp/components/rhs_root_post.jsx b/webapp/components/rhs_root_post.jsx index 023387bb4..65bc52f73 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 = ( <ProfilePicture @@ -516,6 +523,7 @@ export default class RhsRootPost extends React.Component { } } + let postClass = ''; if (PostUtils.isEdited(this.props.post)) { postClass += ' post--edited'; } @@ -581,7 +589,7 @@ export default class RhsRootPost extends React.Component { return ( <div id='thread--root' - className={'post post--root post--thread ' + userCss + ' ' + systemMessageClass + ' ' + compactClass} + className={this.getClassName(post, isSystemMessage)} > <div className='post-right-channel__name'>{channelName}</div> <div className='post__content'> |