Skip to content

Commit

Permalink
MM-15228 consecutive bot posts maintain the profile image (mattermost…
Browse files Browse the repository at this point in the history
…#2716)

* consecutive bot posts maintain the profile image

* new post.props 'from_bot'
  • Loading branch information
scottleedavis authored and hmhealey committed May 10, 2019
1 parent 8ba14ec commit f9cf512
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions components/post_view/post/post.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export default class Post extends React.PureComponent {
return false;
}

getClassName = (post, isSystemMessage, fromWebhook, fromAutoResponder) => {
getClassName = (post, isSystemMessage, fromWebhook, fromAutoResponder, fromBot) => {
let className = 'post';

if (post.failed || post.state === Posts.POST_DELETED) {
Expand All @@ -138,7 +138,7 @@ export default class Post extends React.PureComponent {
}

let rootUser = '';
if (this.state.sameRoot) {
if (this.state.sameRoot && !fromBot) {
rootUser = 'same--root';
} else {
rootUser = 'other--root';
Expand Down Expand Up @@ -211,9 +211,10 @@ export default class Post extends React.PureComponent {
const isSystemMessage = PostUtils.isSystemMessage(post);
const fromAutoResponder = PostUtils.fromAutoResponder(post);
const fromWebhook = post && post.props && post.props.from_webhook === 'true';
const fromBot = post && post.props && post.props.from_bot === 'true';

let profilePic;
const hideProfilePicture = this.state.sameRoot && this.props.consecutivePostByUser && (!post.root_id && this.props.replyCount === 0);
const hideProfilePicture = this.state.sameRoot && this.props.consecutivePostByUser && (!post.root_id && this.props.replyCount === 0) && !fromBot;
if (!hideProfilePicture) {
profilePic = (
<PostProfilePicture
Expand Down Expand Up @@ -241,7 +242,7 @@ export default class Post extends React.PureComponent {
<div
ref={this.getRef}
id={'post_' + post.id}
className={this.getClassName(post, isSystemMessage, fromWebhook, fromAutoResponder)}
className={this.getClassName(post, isSystemMessage, fromWebhook, fromAutoResponder, fromBot)}
onMouseOver={this.setHover}
onMouseLeave={this.unsetHover}
onTouchStart={this.setHover}
Expand Down

0 comments on commit f9cf512

Please sign in to comment.