From b114062c1b8128fe650fce72454ba4f1fcbe5733 Mon Sep 17 00:00:00 2001
From: Harrison Healey <harrisonmhealey@gmail.com>
Date: Wed, 6 Jul 2016 16:07:56 -0400
Subject: 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
---
 webapp/components/admin_console/image_settings.jsx | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

(limited to 'webapp/components/admin_console/image_settings.jsx')

diff --git a/webapp/components/admin_console/image_settings.jsx b/webapp/components/admin_console/image_settings.jsx
index 48a212db1..8e8e2868e 100644
--- a/webapp/components/admin_console/image_settings.jsx
+++ b/webapp/components/admin_console/image_settings.jsx
@@ -17,15 +17,6 @@ export default class ImageSettings extends AdminSettings {
         this.getConfigFromState = this.getConfigFromState.bind(this);
 
         this.renderSettings = this.renderSettings.bind(this);
-
-        this.state = Object.assign(this.state, {
-            thumbnailWidth: props.config.FileSettings.ThumbnailWidth,
-            thumbnailHeight: props.config.FileSettings.ThumbnailHeight,
-            profileWidth: props.config.FileSettings.ProfileWidth,
-            profileHeight: props.config.FileSettings.ProfileHeight,
-            previewWidth: props.config.FileSettings.PreviewWidth,
-            previewHeight: props.config.FileSettings.PreviewHeight
-        });
     }
 
     getConfigFromState(config) {
@@ -39,6 +30,17 @@ export default class ImageSettings extends AdminSettings {
         return config;
     }
 
+    getStateFromConfig(config) {
+        return {
+            thumbnailWidth: config.FileSettings.ThumbnailWidth,
+            thumbnailHeight: config.FileSettings.ThumbnailHeight,
+            profileWidth: config.FileSettings.ProfileWidth,
+            profileHeight: config.FileSettings.ProfileHeight,
+            previewWidth: config.FileSettings.PreviewWidth,
+            previewHeight: config.FileSettings.PreviewHeight
+        };
+    }
+
     renderTitle() {
         return (
             <h3>
-- 
cgit v1.2.3-1-g7c22

