summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorenahum <nahumhbl@gmail.com>2016-07-04 06:59:07 -0400
committerJoram Wilander <jwawilander@gmail.com>2016-07-04 06:59:07 -0400
commit0cdc242cfdbc01d2dfb7315534e7ab34a5559beb (patch)
tree74226694bcd279746c186d6061a67c8744753c2d
parent24fe19965a616fd0c9a5e754a7dd83231be8bf83 (diff)
downloadchat-0cdc242cfdbc01d2dfb7315534e7ab34a5559beb.tar.gz
chat-0cdc242cfdbc01d2dfb7315534e7ab34a5559beb.tar.bz2
chat-0cdc242cfdbc01d2dfb7315534e7ab34a5559beb.zip
PLT-3444 Preview features checkboxes don't reset after hitting cancel (#3462)
-rw-r--r--webapp/components/user_settings/user_settings_advanced.jsx14
1 files changed, 13 insertions, 1 deletions
diff --git a/webapp/components/user_settings/user_settings_advanced.jsx b/webapp/components/user_settings/user_settings_advanced.jsx
index 37a7a894f..cc5d2ee6d 100644
--- a/webapp/components/user_settings/user_settings_advanced.jsx
+++ b/webapp/components/user_settings/user_settings_advanced.jsx
@@ -20,6 +20,7 @@ export default class AdvancedSettingsDisplay extends React.Component {
constructor(props) {
super(props);
+ this.getStateFromStores = this.getStateFromStores.bind(this);
this.updateSection = this.updateSection.bind(this);
this.updateSetting = this.updateSetting.bind(this);
this.toggleFeature = this.toggleFeature.bind(this);
@@ -27,6 +28,10 @@ export default class AdvancedSettingsDisplay extends React.Component {
this.renderFormattingSection = this.renderFormattingSection.bind(this);
+ this.state = this.getStateFromStores();
+ }
+
+ getStateFromStores() {
const preReleaseFeaturesKeys = Object.keys(PreReleaseFeatures);
const advancedSettings = PreferenceStore.getCategory(Constants.Preferences.CATEGORY_ADVANCED_SETTINGS);
const settings = {
@@ -57,7 +62,11 @@ export default class AdvancedSettingsDisplay extends React.Component {
}
}
- this.state = {preReleaseFeatures: PreReleaseFeatures, settings, preReleaseFeaturesKeys, enabledFeatures};
+ return {preReleaseFeatures: PreReleaseFeatures,
+ settings,
+ preReleaseFeaturesKeys,
+ enabledFeatures
+ };
}
updateSetting(setting, value) {
@@ -118,6 +127,9 @@ export default class AdvancedSettingsDisplay extends React.Component {
updateSection(section) {
$('.settings-modal .modal-body').scrollTop(0).perfectScrollbar('update');
+ if (!section) {
+ this.setState(this.getStateFromStores());
+ }
this.props.updateSection(section);
}