Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

Commit

Permalink
[MM-23995] [MM-23996] Fix improper rendering of bot profile picture a…
Browse files Browse the repository at this point in the history
…nd bot roles (#5294)

* MM-23995 Pass bot user to props correctly

* MM-23996 Dont use formatted message inside of option select instead use utils method
  • Loading branch information
fmunshi committed Apr 13, 2020
1 parent 8d896e2 commit bcb86d7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
10 changes: 2 additions & 8 deletions components/integrations/bots/add_bot/add_bot.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -572,18 +572,12 @@ export default class AddBot extends React.Component {
<option
value={roleOptionMember}
>
<FormattedMessage
id='bot.add.role.member'
defaultMessage='Member'
/>
{Utils.localizeMessage('bot.add.role.member', 'Member')}
</option>
<option
value={roleOptionSystemAdmin}
>
<FormattedMessage
id='bot.add.role.admin'
defaultMessage='System Admin'
/>
{Utils.localizeMessage('bot.add.role.admin', 'System Admin')}
</option>
</select>
<div className='form__help'>
Expand Down
5 changes: 3 additions & 2 deletions components/integrations/bots/add_bot/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {updateUserRoles, uploadProfileImage, setDefaultProfileImage, createUserA
import {createBot, patchBot} from 'mattermost-redux/actions/bots';
import {getBotAccounts} from 'mattermost-redux/selectors/entities/bots';
import {getConfig} from 'mattermost-redux/selectors/entities/general';
import {getUsers} from 'mattermost-redux/selectors/entities/common';
import {getUser} from 'mattermost-redux/selectors/entities/users';
import {haveISystemPermission} from 'mattermost-redux/selectors/entities/roles';
import {Permissions} from 'mattermost-redux/constants';

Expand All @@ -19,13 +19,14 @@ function mapStateToProps(state, ownProps) {
const botId = (new URLSearchParams(ownProps.location.search)).get('id');
const bots = getBotAccounts(state);
const bot = bots ? bots[botId] : null;
const user = bot ? getUsers(state)[bot.user_id] : null;
const user = bot ? getUser(state, bot.user_id) : null;
const roles = user ? user.roles : null;
return {
maxFileSize: parseInt(config.MaxFileSize, 10),
bot,
roles,
editingUserHasManageSystem: haveISystemPermission(state, {permission: Permissions.MANAGE_SYSTEM}),
user,
};
}

Expand Down

0 comments on commit bcb86d7

Please sign in to comment.