diff options
author | Harrison Healey <harrisonmhealey@gmail.com> | 2015-10-05 16:02:09 -0400 |
---|---|---|
committer | Harrison Healey <harrisonmhealey@gmail.com> | 2015-10-05 16:02:09 -0400 |
commit | e2e00d9d43c14806cd5a5c424b9879636dfd89c8 (patch) | |
tree | 607e55539a4827382bfdc331400885fdd073922c /web/react/components/rename_channel_modal.jsx | |
parent | 193732ffbf1107fd146412ce38a053354d972e25 (diff) | |
parent | 33b957ed1a8a44d4bed0f9c674d5602bad5028ea (diff) | |
download | chat-e2e00d9d43c14806cd5a5c424b9879636dfd89c8.tar.gz chat-e2e00d9d43c14806cd5a5c424b9879636dfd89c8.tar.bz2 chat-e2e00d9d43c14806cd5a5c424b9879636dfd89c8.zip |
Merge pull request #922 from mattermost/plt-360
PLT-360 Upgrade and changes to ESLint
Diffstat (limited to 'web/react/components/rename_channel_modal.jsx')
-rw-r--r-- | web/react/components/rename_channel_modal.jsx | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/web/react/components/rename_channel_modal.jsx b/web/react/components/rename_channel_modal.jsx index 9d514c741..d60206ecf 100644 --- a/web/react/components/rename_channel_modal.jsx +++ b/web/react/components/rename_channel_modal.jsx @@ -15,6 +15,7 @@ export default class RenameChannelModal extends React.Component { this.onDisplayNameChange = this.onDisplayNameChange.bind(this); this.displayNameKeyUp = this.displayNameKeyUp.bind(this); this.handleClose = this.handleClose.bind(this); + this.handleShow = this.handleShow.bind(this); this.handleSubmit = this.handleSubmit.bind(this); this.state = { @@ -59,11 +60,11 @@ export default class RenameChannelModal extends React.Component { state.invalid = true; } else { let cleanedName = Utils.cleanUpUrlable(channel.name); - if (cleanedName !== channel.name) { + if (cleanedName === channel.name) { + state.nameError = ''; + } else { state.nameError = 'Must be lowercase alphanumeric characters'; state.invalid = true; - } else { - state.nameError = ''; } } @@ -103,7 +104,7 @@ export default class RenameChannelModal extends React.Component { this.setState({channelName: channelName}); } handleClose() { - this.state = { + this.setState({ displayName: '', channelName: '', channelId: '', @@ -111,13 +112,14 @@ export default class RenameChannelModal extends React.Component { nameError: '', displayNameError: '', invalid: false - }; + }); + } + handleShow(e) { + const button = $(e.relatedTarget); + this.setState({displayName: button.attr('data-display'), channelName: button.attr('data-name'), channelId: button.attr('data-channelid')}); } componentDidMount() { - $(React.findDOMNode(this.refs.modal)).on('show.bs.modal', function handleShow(e) { - const button = $(e.relatedTarget); - this.setState({displayName: button.attr('data-display'), channelName: button.attr('data-name'), channelId: button.attr('data-channelid')}); - }.bind(this)); + $(React.findDOMNode(this.refs.modal)).on('show.bs.modal', this.handleShow); $(React.findDOMNode(this.refs.modal)).on('hidden.bs.modal', this.handleClose); } componentWillUnmount() { |