summaryrefslogtreecommitdiffstats
path: root/web/react/components/user_settings.jsx
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2015-08-04 09:00:45 -0400
committerChristopher Speller <crspeller@gmail.com>2015-08-04 09:00:45 -0400
commit2c46ee8420eb19d827d3f2072bd536aae2038f84 (patch)
treedde3b3b322ace586052a41ee92e61e8b047a2cd4 /web/react/components/user_settings.jsx
parent42c5d0d366cb38866dd6d2ce7e8485ac7a2746a4 (diff)
parentac53536385a4ba828f09800a053885db5e5b9e02 (diff)
downloadchat-2c46ee8420eb19d827d3f2072bd536aae2038f84.tar.gz
chat-2c46ee8420eb19d827d3f2072bd536aae2038f84.tar.bz2
chat-2c46ee8420eb19d827d3f2072bd536aae2038f84.zip
Merge pull request #309 from nickago/MM-1691
MM-1691/1692 Reset User settings tab on close
Diffstat (limited to 'web/react/components/user_settings.jsx')
-rw-r--r--web/react/components/user_settings.jsx17
1 files changed, 13 insertions, 4 deletions
diff --git a/web/react/components/user_settings.jsx b/web/react/components/user_settings.jsx
index 95d1178d1..c574d2365 100644
--- a/web/react/components/user_settings.jsx
+++ b/web/react/components/user_settings.jsx
@@ -102,6 +102,8 @@ var NotificationsTab = React.createClass({
});
this.setState(assign({},getNotificationsStateFromStores(),{server_error: null}));
+
+ this.props.updateTab('general');
},
componentDidMount: function() {
UserStore.addChangeListener(this._onChange);
@@ -110,6 +112,7 @@ var NotificationsTab = React.createClass({
componentWillUnmount: function() {
UserStore.removeChangeListener(this._onChange);
$('#user_settings1').off('hidden.bs.modal', this.handleClose);
+ this.props.updateSection('');
},
_onChange: function() {
var newState = getNotificationsStateFromStores();
@@ -522,12 +525,14 @@ var SecurityTab = React.createClass({
this.value = "";
});
this.setState({current_password: '', new_password: '', confirm_password: '', server_error: null, password_error: null});
+ this.props.updateTab('general');
},
componentDidMount: function() {
$('#user_settings1').on('hidden.bs.modal', this.handleClose);
},
componentWillUnmount: function() {
$('#user_settings1').off('hidden.bs.modal', this.handleClose);
+ this.props.updateSection('');
},
getInitialState: function() {
return { current_password: '', new_password: '', confirm_password: '' };
@@ -794,6 +799,7 @@ var GeneralTab = React.createClass({
});
this.setState(assign({}, this.getInitialState(), {client_error: null, server_error: null, email_error: null}));
+ this.props.updateSection('');
},
componentDidMount: function() {
$('#user_settings1').on('hidden.bs.modal', this.handleClose);
@@ -1063,6 +1069,7 @@ var AppearanceTab = React.createClass({
},
handleClose: function() {
this.setState({server_error: null});
+ this.props.updateTab('general');
},
componentDidMount: function() {
if (this.props.activeSection === "theme") {
@@ -1078,6 +1085,7 @@ var AppearanceTab = React.createClass({
},
componentWillUnmount: function() {
$('#user_settings1').off('hidden.bs.modal', this.handleClose);
+ this.props.updateSection('');
},
getInitialState: function() {
var user = UserStore.getCurrentUser();
@@ -1146,10 +1154,11 @@ var AppearanceTab = React.createClass({
</div>
</div>
);
- }
+ }
});
module.exports = React.createClass({
+ displayName: 'UserSettings',
componentDidMount: function() {
UserStore.addChangeListener(this._onChange);
},
@@ -1175,19 +1184,19 @@ module.exports = React.createClass({
} else if (this.props.activeTab === 'security') {
return (
<div>
- <SecurityTab user={this.state.user} activeSection={this.props.activeSection} updateSection={this.props.updateSection} />
+ <SecurityTab user={this.state.user} activeSection={this.props.activeSection} updateSection={this.props.updateSection} updateTab={this.props.updateTab} />
</div>
);
} else if (this.props.activeTab === 'notifications') {
return (
<div>
- <NotificationsTab user={this.state.user} activeSection={this.props.activeSection} updateSection={this.props.updateSection} />
+ <NotificationsTab user={this.state.user} activeSection={this.props.activeSection} updateSection={this.props.updateSection} updateTab={this.props.updateTab} />
</div>
);
} else if (this.props.activeTab === 'appearance') {
return (
<div>
- <AppearanceTab activeSection={this.props.activeSection} updateSection={this.props.updateSection} />
+ <AppearanceTab activeSection={this.props.activeSection} updateSection={this.props.updateSection} updateTab={this.props.updateTab} />
</div>
);
} else {