summaryrefslogtreecommitdiffstats
path: root/web/react/components/rename_channel_modal.jsx
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2015-10-05 09:58:42 -0400
committerChristopher Speller <crspeller@gmail.com>2015-10-05 11:05:06 -0400
commit33b957ed1a8a44d4bed0f9c674d5602bad5028ea (patch)
treeeecee1a84d2da761345c244fa8078488a52eba94 /web/react/components/rename_channel_modal.jsx
parent515d709c2ef13b6ed7a3d04a7ad2fb2acbb0ec5d (diff)
downloadchat-33b957ed1a8a44d4bed0f9c674d5602bad5028ea.tar.gz
chat-33b957ed1a8a44d4bed0f9c674d5602bad5028ea.tar.bz2
chat-33b957ed1a8a44d4bed0f9c674d5602bad5028ea.zip
Disabling complexity warning. Allowing non-nested ternary. Upgrading ESList. Adding new ESLint rules. Fixing new ESLint errors.
Diffstat (limited to 'web/react/components/rename_channel_modal.jsx')
-rw-r--r--web/react/components/rename_channel_modal.jsx20
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() {