Skip to content

Commit

Permalink
[MM-23635] Only load bot icon url when it's been updated (mattermost#…
Browse files Browse the repository at this point in the history
  • Loading branch information
devinbinnie committed Mar 27, 2020
1 parent 432e217 commit 82d8367
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,16 @@ type OwnProps = {
/**
* Gets the LHS bot icon url for a given botUser.
*/
function botIconImageUrl(botUser: UserProfile) {
function botIconImageUrl(botUser: UserProfile & {bot_last_icon_update?: number}) {
if (!botUser) {
return null;
}

return `${Client4.getBotRoute(botUser.id)}/icon?_=${((botUser as any).bot_last_icon_update || 0)}`;
if (!(botUser.is_bot && botUser.bot_last_icon_update)) {
return null;
}

return `${Client4.getBotRoute(botUser.id)}/icon?_=${(botUser.bot_last_icon_update || 0)}`;
}

function mapStateToProps(state: GlobalState, ownProps: OwnProps) {
Expand Down

0 comments on commit 82d8367

Please sign in to comment.