diff options
author | Christopher Speller <crspeller@gmail.com> | 2016-03-03 15:15:56 -0500 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2016-03-03 15:15:56 -0500 |
commit | a413c8ffa684b72840f116380c04a61f1d9cf524 (patch) | |
tree | 287e855db2906058928f1916cbd3fa84857fdcc3 /web/react/components/admin_console/user_item.jsx | |
parent | bc2768fd254e82b6ca39a916436ab4747898578e (diff) | |
parent | 449f1000e999c409f754724cb998f0b9f90cdd59 (diff) | |
download | chat-a413c8ffa684b72840f116380c04a61f1d9cf524.tar.gz chat-a413c8ffa684b72840f116380c04a61f1d9cf524.tar.bz2 chat-a413c8ffa684b72840f116380c04a61f1d9cf524.zip |
Merge pull request #2318 from hmhealey/plt1090
PLT-1090 Refactored modals that display users
Diffstat (limited to 'web/react/components/admin_console/user_item.jsx')
-rw-r--r-- | web/react/components/admin_console/user_item.jsx | 61 |
1 files changed, 34 insertions, 27 deletions
diff --git a/web/react/components/admin_console/user_item.jsx b/web/react/components/admin_console/user_item.jsx index 009a9f004..4af350bcd 100644 --- a/web/react/components/admin_console/user_item.jsx +++ b/web/react/components/admin_console/user_item.jsx @@ -7,26 +7,7 @@ import UserStore from '../../stores/user_store.jsx'; import ConfirmModal from '../confirm_modal.jsx'; import TeamStore from '../../stores/team_store.jsx'; -import {injectIntl, intlShape, defineMessages, FormattedMessage} from 'mm-intl'; - -var holders = defineMessages({ - confirmDemoteRoleTitle: { - id: 'admin.user_item.confirmDemoteRoleTitle', - defaultMessage: 'Confirm demotion from System Admin role' - }, - confirmDemotion: { - id: 'admin.user_item.confirmDemotion', - defaultMessage: 'Confirm Demotion' - }, - confirmDemoteDescription: { - id: 'admin.user_item.confirmDemoteDescription', - defaultMessage: 'If you demote yourself from the System Admin role and there is not another user with System Admin privileges, you\'ll need to re-assign a System Admin by accessing the Mattermost server through a terminal and running the following command.' - }, - confirmDemotionCmd: { - id: 'admin.user_item.confirmDemotionCmd', - defaultMessage: 'platform -assign_role -team_name="yourteam" -email="name@yourcompany.com" -role="system_admin"' - } -}); +import {FormattedMessage} from 'mm-intl'; export default class UserItem extends React.Component { constructor(props) { @@ -336,15 +317,44 @@ export default class UserItem extends React.Component { ); } const me = UserStore.getCurrentUser(); - const {formatMessage} = this.props.intl; let makeDemoteModal = null; if (this.props.user.id === me.id) { + const title = ( + <FormattedMessage + id='admin.user_item.confirmDemoteRoleTitle' + defaultMessage='Confirm demotion from System Admin role' + /> + ); + + const message = ( + <div> + <FormattedMessage + id='admin.user_item.confirmDemoteDescription' + defaultMessage="If you demote yourself from the System Admin role and there is not another user with System Admin privileges, you\'ll need to re-assign a System Admin by accessing the Mattermost server through a terminal and running the following command." + /> + <br/> + <br/> + <FormattedMessage + id='admin.user_item.confirmDemotionCmd' + defaultMessage='platform -assign_role -team_name="yourteam" -email="name@yourcompany.com" -role="system_admin"' + /> + {serverError} + </div> + ); + + const confirmButton = ( + <FormattedMessage + id='admin.user_item.confirmDemotion' + defaultMessage='Confirm Demotion' + /> + ); + makeDemoteModal = ( <ConfirmModal show={this.state.showDemoteModal} - title={formatMessage(holders.confirmDemoteRoleTitle)} - message={[formatMessage(holders.confirmDemoteDescription), React.createElement('br'), React.createElement('br'), formatMessage(holders.confirmDemotionCmd), serverError]} - confirm_button={formatMessage(holders.confirmDemotion)} + title={title} + message={message} + confirmButton={confirmButton} onConfirm={this.handleDemoteSubmit} onCancel={this.handleDemoteCancel} /> @@ -405,10 +415,7 @@ export default class UserItem extends React.Component { } UserItem.propTypes = { - intl: intlShape.isRequired, user: React.PropTypes.object.isRequired, refreshProfiles: React.PropTypes.func.isRequired, doPasswordReset: React.PropTypes.func.isRequired }; - -export default injectIntl(UserItem); |