REFACTOR: improve the code readability. (#8211)

REFACTOR: improve the code readability. (#8211)

b2f682f35eba0cc3f09588356ecf8d1dd824542f

diff --git a/app/assets/javascripts/admin/components/site-setting.js.es6 b/app/assets/javascripts/admin/components/site-setting.js.es6
index 4c1d76cad8..e94713f476 100644
--- a/app/assets/javascripts/admin/components/site-setting.js.es6
+++ b/app/assets/javascripts/admin/components/site-setting.js.es6
@@ -5,14 +5,6 @@ import showModal from "discourse/lib/show-modal";
 import AboutRoute from "discourse/routes/about";
 
 export default Ember.Component.extend(BufferedContent, SettingComponent, {
-  update(key, value, updateExistingUsers = false) {
-    if (updateExistingUsers) {
-      return SiteSetting.update(key, value, { updateExistingUsers: true });
-    } else {
-      return SiteSetting.update(key, value);
-    }
-  },
-
   _save(callback) {
     const defaultCategoriesSettings = [
       "default_categories_watching",
@@ -36,19 +28,16 @@ export default Ember.Component.extend(BufferedContent, SettingComponent, {
             admin: true
           });
 
-          controller.setProperties({
-            onClose: () => {
-              const updateExistingUsers = controller.get("updateExistingUsers");
-              if (updateExistingUsers === true) {
-                callback(this.update(key, value, true));
-              } else if (updateExistingUsers === false) {
-                callback(this.update(key, value));
-              }
-            }
+          controller.set("onClose", () => {
+            callback(
+              SiteSetting.update(key, value, {
+                updateExistingUsers: controller.updateExistingUsers
+              })
+            );
           });
         });
     } else {
-      callback(this.update(key, value));
+      callback(SiteSetting.update(key, value));
     }
   }
 });
diff --git a/app/assets/javascripts/admin/mixins/setting-component.js.es6 b/app/assets/javascripts/admin/mixins/setting-component.js.es6
index a2d5b3a4de..397817d793 100644
--- a/app/assets/javascripts/admin/mixins/setting-component.js.es6
+++ b/app/assets/javascripts/admin/mixins/setting-component.js.es6
@@ -116,7 +116,7 @@ export default Ember.Mixin.create({
           .then(() => {
             this.set("validationMessage", null);
             this.commitBuffer();
-            if (AUTO_REFRESH_ON_SAVE.includes(this.get("setting.setting"))) {
+            if (AUTO_REFRESH_ON_SAVE.includes(this.setting.setting)) {
               this.afterSave();
             }
           })
diff --git a/app/assets/javascripts/admin/templates/modal/site-setting-default-categories.hbs b/app/assets/javascripts/admin/templates/modal/site-setting-default-categories.hbs
index e56bf01c65..0bd05c2ba8 100644
--- a/app/assets/javascripts/admin/templates/modal/site-setting-default-categories.hbs
+++ b/app/assets/javascripts/admin/templates/modal/site-setting-default-categories.hbs
@@ -3,6 +3,6 @@
 {{/d-modal-body}}
 
 <div class="modal-footer">
-  {{d-button action=(action "updateExistingUsers") class='btn btn-primary' label='admin.site_settings.default_categories.modal_yes'}}
-  {{d-button action=(action "cancel") class='btn' label='admin.site_settings.default_categories.modal_no'}}
+  {{d-button action=(action "updateExistingUsers") class='btn-primary' label='admin.site_settings.default_categories.modal_yes'}}
+  {{d-button action=(action "cancel") label='admin.site_settings.default_categories.modal_no'}}
 </div>

GitHub sha: 3cdcd093