diff options
author | David Lu <david.lu@hotmail.com> | 2016-06-27 08:13:16 -0400 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2016-06-27 08:13:16 -0400 |
commit | 5be6661f12171b6e09bccfc32c1b46ef042f46ac (patch) | |
tree | 65e42a83b439d8e8c9a4e0e6692fc6a1f243c1b3 /webapp/components/edit_channel_header_modal.jsx | |
parent | 3ec92b8c60c8884f2e093dd77ab6f4760affe25f (diff) | |
download | chat-5be6661f12171b6e09bccfc32c1b46ef042f46ac.tar.gz chat-5be6661f12171b6e09bccfc32c1b46ef042f46ac.tar.bz2 chat-5be6661f12171b6e09bccfc32c1b46ef042f46ac.zip |
PLT-3332 Removed multiple change channel header messages (#3390)
* disabled submit upon form submission to avoid asynchronous errors
* Used state instead of props
Diffstat (limited to 'webapp/components/edit_channel_header_modal.jsx')
-rw-r--r-- | webapp/components/edit_channel_header_modal.jsx | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/webapp/components/edit_channel_header_modal.jsx b/webapp/components/edit_channel_header_modal.jsx index d7ef1d81f..394c0e21c 100644 --- a/webapp/components/edit_channel_header_modal.jsx +++ b/webapp/components/edit_channel_header_modal.jsx @@ -36,7 +36,8 @@ class EditChannelHeaderModal extends React.Component { this.state = { header: props.channel.header, - serverError: '' + serverError: '', + submitted: false }; } @@ -55,7 +56,8 @@ class EditChannelHeaderModal extends React.Component { componentWillReceiveProps(nextProps) { if (this.props !== nextProps) { this.setState({ - header: nextProps.channel.header + header: nextProps.channel.header, + submitted: false }); } } @@ -77,6 +79,8 @@ class EditChannelHeaderModal extends React.Component { } handleSubmit() { + this.setState({submitted: true}); + Client.updateChannelHeader( this.props.channel.id, this.state.header, @@ -102,6 +106,7 @@ class EditChannelHeaderModal extends React.Component { onShow() { const textarea = ReactDOM.findDOMNode(this.refs.textarea); Utils.placeCaretAtEnd(textarea); + this.submitted = false; } onHide() { @@ -190,6 +195,7 @@ class EditChannelHeaderModal extends React.Component { /> </button> <button + disabled={this.state.submitted} type='button' className='btn btn-primary' onClick={this.handleSubmit} |