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
This commit is contained in:
scott lee davis 2019-05-01 06:08:50 -07:00 committed by Elias Nahum
parent fee9a96a11
commit 5a70bedcbe
2 changed files with 7 additions and 1 deletions

View file

@ -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),
};
}

View file

@ -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 (
<View>
<AppIcon