diff options
author | Joram Wilander <jwawilander@gmail.com> | 2017-08-01 11:06:53 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-01 11:06:53 -0400 |
commit | 5da5c0bbfb80cb5c9cf2699f42d17decc2d60f5b (patch) | |
tree | fdd886332e75a9ae8138a31d3c34b240adb094b5 /webapp/components/admin_console/system_users/system_users.jsx | |
parent | 4ef844298fdb0d6fb41eac760f8ac00cee82b3bc (diff) | |
download | chat-5da5c0bbfb80cb5c9cf2699f42d17decc2d60f5b.tar.gz chat-5da5c0bbfb80cb5c9cf2699f42d17decc2d60f5b.tar.bz2 chat-5da5c0bbfb80cb5c9cf2699f42d17decc2d60f5b.zip |
PLT-6987 User access token UI (#7007)
* Add user access token UI
* Fix enter press and update mattermost-redux
* Updating UI for access token stuff (#7066)
* Revert segment key
Diffstat (limited to 'webapp/components/admin_console/system_users/system_users.jsx')
-rw-r--r-- | webapp/components/admin_console/system_users/system_users.jsx | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/webapp/components/admin_console/system_users/system_users.jsx b/webapp/components/admin_console/system_users/system_users.jsx index 5c8aa9bfd..4fbdc26d8 100644 --- a/webapp/components/admin_console/system_users/system_users.jsx +++ b/webapp/components/admin_console/system_users/system_users.jsx @@ -54,7 +54,12 @@ export default class SystemUsers extends React.Component { /* * Function to get a user */ - getUser: PropTypes.func.isRequired + getUser: PropTypes.func.isRequired, + + /* + * Function to get a user access token + */ + getUserAccessToken: PropTypes.func.isRequired }).isRequired } @@ -240,7 +245,7 @@ export default class SystemUsers extends React.Component { (users) => { if (users.length === 0 && term.length === USER_ID_LENGTH) { // This term didn't match any users name, but it does look like it might be a user's ID - this.getUserById(term); + this.getUserByTokenOrId(term); } else { this.setState({loading: false}); } @@ -269,6 +274,22 @@ export default class SystemUsers extends React.Component { ); } + getUserByTokenOrId = async (id) => { + if (global.window.mm_config.EnableUserAccessTokens === 'true') { + const {data} = await this.props.actions.getUserAccessToken(id); + + if (data) { + this.term = data.user_id; + this.setState({term: data.user_id}); + this.updateUsersFromStore(this.state.teamId, data.user_id); + this.getUserById(data.user_id); + return; + } + } + + this.getUserById(id); + } + renderFilterRow(doSearch) { const teams = this.props.teams.map((team) => { return ( |