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 | |
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')
-rw-r--r-- | webapp/components/edit_channel_header_modal.jsx | 10 | ||||
-rw-r--r-- | webapp/components/edit_channel_purpose_modal.jsx | 7 |
2 files changed, 14 insertions, 3 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} diff --git a/webapp/components/edit_channel_purpose_modal.jsx b/webapp/components/edit_channel_purpose_modal.jsx index 0d5fb90ac..747ac6fed 100644 --- a/webapp/components/edit_channel_purpose_modal.jsx +++ b/webapp/components/edit_channel_purpose_modal.jsx @@ -31,7 +31,8 @@ export default class EditChannelPurposeModal extends React.Component { this.ctrlSend = PreferenceStore.getBool(Constants.Preferences.CATEGORY_ADVANCED_SETTINGS, 'send_on_ctrl_enter'); this.state = { - serverError: '' + serverError: '', + submitted: false }; } @@ -75,6 +76,9 @@ export default class EditChannelPurposeModal extends React.Component { if (!this.props.channel) { return; } + + this.setState({submitted: true}); + Client.updateChannelPurpose( this.props.channel.id, ReactDOM.findDOMNode(this.refs.purpose).value.trim(), @@ -189,6 +193,7 @@ export default class EditChannelPurposeModal extends React.Component { <button type='button' className='btn btn-primary' + disabled={this.state.submitted} onClick={this.handleSave} > <FormattedMessage |