diff options
author | Harrison Healey <harrisonmhealey@gmail.com> | 2016-07-06 16:07:56 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-06 16:07:56 -0400 |
commit | b114062c1b8128fe650fce72454ba4f1fcbe5733 (patch) | |
tree | 0a51e9d1342bf89c435662c618d9aac5ba651b4b /webapp/components/admin_console/push_settings.jsx | |
parent | b1520d0b9458d1dab09d9e3e05dd7522fc28ba57 (diff) | |
download | chat-b114062c1b8128fe650fce72454ba4f1fcbe5733.tar.gz chat-b114062c1b8128fe650fce72454ba4f1fcbe5733.tar.bz2 chat-b114062c1b8128fe650fce72454ba4f1fcbe5733.zip |
PLT-3237 Update displayed config values in admin console after saving (#3506)
* Reloaded admin console data when settings are saved
* Fixed attempting to save an invalid config setting overwriting the stored config
Diffstat (limited to 'webapp/components/admin_console/push_settings.jsx')
-rw-r--r-- | webapp/components/admin_console/push_settings.jsx | 58 |
1 files changed, 30 insertions, 28 deletions
diff --git a/webapp/components/admin_console/push_settings.jsx b/webapp/components/admin_console/push_settings.jsx index e5d6c7197..73189cd8f 100644 --- a/webapp/components/admin_console/push_settings.jsx +++ b/webapp/components/admin_console/push_settings.jsx @@ -28,34 +28,6 @@ export default class PushSettings extends AdminSettings { this.getConfigFromState = this.getConfigFromState.bind(this); this.renderSettings = this.renderSettings.bind(this); - - let pushNotificationServerType = PUSH_NOTIFICATIONS_CUSTOM; - let agree = false; - if (!props.config.EmailSettings.SendPushNotifications) { - pushNotificationServerType = PUSH_NOTIFICATIONS_OFF; - } else if (props.config.EmailSettings.PushNotificationServer === Constants.MHPNS && - global.window.mm_license.IsLicensed === 'true' && global.window.mm_license.MHPNS === 'true') { - pushNotificationServerType = PUSH_NOTIFICATIONS_MHPNS; - agree = true; - } else if (props.config.EmailSettings.PushNotificationServer === Constants.MTPNS) { - pushNotificationServerType = PUSH_NOTIFICATIONS_MTPNS; - } else { - pushNotificationServerType = PUSH_NOTIFICATIONS_CUSTOM; - } - - let pushNotificationServer = this.props.config.EmailSettings.PushNotificationServer; - if (pushNotificationServerType === PUSH_NOTIFICATIONS_MTPNS) { - pushNotificationServer = Constants.MTPNS; - } else if (pushNotificationServerType === PUSH_NOTIFICATIONS_MHPNS) { - pushNotificationServer = Constants.MHPNS; - } - - this.state = Object.assign(this.state, { - pushNotificationServerType, - pushNotificationServer, - pushNotificationContents: props.config.EmailSettings.PushNotificationContents, - agree - }); } canSave() { @@ -96,6 +68,36 @@ export default class PushSettings extends AdminSettings { return config; } + getStateFromConfig(config) { + let pushNotificationServerType = PUSH_NOTIFICATIONS_CUSTOM; + let agree = false; + if (!config.EmailSettings.SendPushNotifications) { + pushNotificationServerType = PUSH_NOTIFICATIONS_OFF; + } else if (config.EmailSettings.PushNotificationServer === Constants.MHPNS && + global.window.mm_license.IsLicensed === 'true' && global.window.mm_license.MHPNS === 'true') { + pushNotificationServerType = PUSH_NOTIFICATIONS_MHPNS; + agree = true; + } else if (config.EmailSettings.PushNotificationServer === Constants.MTPNS) { + pushNotificationServerType = PUSH_NOTIFICATIONS_MTPNS; + } else { + pushNotificationServerType = PUSH_NOTIFICATIONS_CUSTOM; + } + + let pushNotificationServer = config.EmailSettings.PushNotificationServer; + if (pushNotificationServerType === PUSH_NOTIFICATIONS_MTPNS) { + pushNotificationServer = Constants.MTPNS; + } else if (pushNotificationServerType === PUSH_NOTIFICATIONS_MHPNS) { + pushNotificationServer = Constants.MHPNS; + } + + return { + pushNotificationServerType, + pushNotificationServer, + pushNotificationContents: config.EmailSettings.PushNotificationContents, + agree + }; + } + renderTitle() { return ( <h3> |