From 33b957ed1a8a44d4bed0f9c674d5602bad5028ea Mon Sep 17 00:00:00 2001 From: Christopher Speller Date: Mon, 5 Oct 2015 09:58:42 -0400 Subject: Disabling complexity warning. Allowing non-nested ternary. Upgrading ESList. Adding new ESLint rules. Fixing new ESLint errors. --- web/react/components/rename_channel_modal.jsx | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'web/react/components/rename_channel_modal.jsx') 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() { -- cgit v1.2.3-1-g7c22