use default value if feature is undefined in config
authorPhilipp Schüle <p.schuele@metaways.de>
Fri, 10 Apr 2015 12:47:49 +0000 (14:47 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Mon, 13 Apr 2015 14:34:23 +0000 (16:34 +0200)
Change-Id: I955ada4e684dc44a0342bbc6d6fc9bc340f73c4b
Reviewed-on: http://gerrit.tine20.com/customers/1814
Tested-by: Jenkins CI (http://ci.tine20.com/)
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
Tested-by: Philipp Schüle <p.schuele@metaways.de>
tine20/Tinebase/js/Application.js

index c63b60c..62b159b 100644 (file)
@@ -97,7 +97,16 @@ Ext.extend(Tine.Tinebase.Application, Ext.util.Observable , {
      * @return {Boolean}
      */
     featureEnabled: function(featureName) {
-        return Tine[this.appName].registry.get("config").features && Tine[this.appName].registry.get("config").features.value[featureName];
+        var featureConfig = Tine[this.appName].registry.get("config").features,
+            result = featureConfig && featureConfig.value[featureName];
+
+        if (result == undefined) {
+            // check defaults if key is missing
+            result = featureConfig && featureConfig.definition && featureConfig.definition.default
+                && featureConfig.definition.default[featureName];
+        }
+
+        return result;
     },
     
     /**