summaryrefslogtreecommitdiffstats
path: root/web/react/components/rename_channel_modal.jsx
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2015-07-24 11:40:42 -0400
committerJoram Wilander <jwawilander@gmail.com>2015-07-24 11:40:42 -0400
commit4f9c40e60b31936977da357214bf1b9fd99a68d7 (patch)
treebf79e07b3eed37b8ab204f9258db5c7c4ee8a32a /web/react/components/rename_channel_modal.jsx
parentb813234f4cc38e72bb94556d3a4acdcde5071468 (diff)
parentdbbe40e893419d78e23b0d73c8bd6a30478cde2c (diff)
downloadchat-4f9c40e60b31936977da357214bf1b9fd99a68d7.tar.gz
chat-4f9c40e60b31936977da357214bf1b9fd99a68d7.tar.bz2
chat-4f9c40e60b31936977da357214bf1b9fd99a68d7.zip
Merge pull request #226 from nickago/MM-1546
MM-1546 Clear error messages on modal close and channel switch
Diffstat (limited to 'web/react/components/rename_channel_modal.jsx')
-rw-r--r--web/react/components/rename_channel_modal.jsx7
1 files changed, 7 insertions, 0 deletions
diff --git a/web/react/components/rename_channel_modal.jsx b/web/react/components/rename_channel_modal.jsx
index 2ae331626..9e4a25f85 100644
--- a/web/react/components/rename_channel_modal.jsx
+++ b/web/react/components/rename_channel_modal.jsx
@@ -89,12 +89,19 @@ module.exports = React.createClass({
this.refs.channel_name.getDOMNode().value = channel_name;
this.setState({ channel_name: channel_name })
},
+ handleClose: function() {
+ this.setState({display_name: "", channel_name: "", display_name_error: "", server_error: "", name_error: ""});
+ },
componentDidMount: function() {
var self = this;
$(this.refs.modal.getDOMNode()).on('show.bs.modal', function(e) {
var button = $(e.relatedTarget);
self.setState({ display_name: button.attr('data-display'), title: button.attr('data-name'), channel_id: button.attr('data-channelid') });
});
+ $(this.refs.modal.getDOMNode()).on('hidden.bs.modal', this.handleClose);
+ },
+ componentWillUnmount: function() {
+ $(this.refs.modal.getDOMNode()).off('hidden.bs.modal', this.handleClose);
},
getInitialState: function() {
return { display_name: "", channel_name: "", channel_id: "" };