FIX: Do not refresh all settings on save for all settings, limit to only a few

FIX: Do not refresh all settings on save for all settings, limit to only a few

diff --git a/app/assets/javascripts/admin/mixins/setting-component.js.es6 b/app/assets/javascripts/admin/mixins/setting-component.js.es6
index 9f8166f..dbed60a 100644
--- a/app/assets/javascripts/admin/mixins/setting-component.js.es6
+++ b/app/assets/javascripts/admin/mixins/setting-component.js.es6
@@ -17,6 +17,8 @@ const CUSTOM_TYPES = [
   "group_list"
 ];
 
+const AUTO_REFRESH_ON_SAVE = ["logo", "logo_small", "large_icon"];
+
 export default Ember.Mixin.create({
   classNameBindings: [":row", ":setting", "overridden", "typeClass"],
   content: Ember.computed.alias("setting"),
@@ -113,7 +115,9 @@ export default Ember.Mixin.create({
         .then(() => {
           this.set("validationMessage", null);
           this.commitBuffer();
-          this.afterSave();
+          if (AUTO_REFRESH_ON_SAVE.includes(this.get("setting.setting"))) {
+            this.afterSave();
+          }
         })
         .catch(e => {
           if (e.jqXHR.responseJSON && e.jqXHR.responseJSON.errors) {

GitHub sha: 0e26c57a

2 Likes

Hi, not sure if this is my place to chime in here on the actual code review but I raised the issue in the meta board.

Given all the images run optimisation on upload, shouldn’t the other images also be added to this AUTO_REFRESH_ON_SAVE array?

Like, shouldn’t it also include:

push_notifications_icon, favicon, etc

The refresh applies to the other logo settings, not the optimizations. All uploads will be optimized regardless of this change.

1 Like