From 5a70bedcbe2ccffc16db57ec489b22aeb6a21064 Mon Sep 17 00:00:00 2001 From: scott lee davis Date: Wed, 1 May 2019 06:08:50 -0700 Subject: [PATCH] MM-15161 show icon for bot instead of system icon in ephemeral post (#2740) * show icon for bot instead of system icon in ephemeral post * added check for if user is null --- app/components/post_profile_picture/index.js | 4 ++++ app/components/post_profile_picture/post_profile_picture.js | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/components/post_profile_picture/index.js b/app/components/post_profile_picture/index.js index c83907fda..efe99e165 100644 --- a/app/components/post_profile_picture/index.js +++ b/app/components/post_profile_picture/index.js @@ -12,9 +12,12 @@ import {fromAutoResponder} from 'app/utils/general'; import PostProfilePicture from './post_profile_picture'; +import {getUser} from 'mattermost-redux/selectors/entities/users'; + function mapStateToProps(state, ownProps) { const config = getConfig(state); const post = ownProps.post; + const user = getUser(state, post.user_id); return { enablePostIconOverride: config.EnablePostIconOverride === 'true' && post?.props?.use_user_icon !== 'true', // eslint-disable-line camelcase @@ -23,6 +26,7 @@ function mapStateToProps(state, ownProps) { fromAutoResponder: fromAutoResponder(post), overrideIconUrl: post?.props?.override_icon_url, // eslint-disable-line camelcase userId: post.user_id, + isBot: (user ? user.is_bot : false), theme: getTheme(state), }; } diff --git a/app/components/post_profile_picture/post_profile_picture.js b/app/components/post_profile_picture/post_profile_picture.js index 68691c858..1e33b18bd 100644 --- a/app/components/post_profile_picture/post_profile_picture.js +++ b/app/components/post_profile_picture/post_profile_picture.js @@ -21,6 +21,7 @@ export default class PostProfilePicture extends PureComponent { onViewUserProfile: PropTypes.func, theme: PropTypes.object, userId: PropTypes.string, + isBot: PropTypes.bool, }; static defaultProps = { @@ -37,9 +38,10 @@ export default class PostProfilePicture extends PureComponent { overrideIconUrl, theme, userId, + isBot, } = this.props; - if (isSystemMessage && !fromAutoResponder) { + if (isSystemMessage && !fromAutoResponder && !isBot) { return (