From ea6d2c35f7e425102186cd370a8d7893d1f88807 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Thu, 21 Apr 2016 15:30:03 -0400 Subject: [PATCH] Fixed bug in settingsv1 If the saved value was an empty string, then textareas (and more importantly, select boxes) would not be properly populated with the saved value. --- public/src/admin/settings.js | 4 ++-- src/controllers/index.js | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/public/src/admin/settings.js b/public/src/admin/settings.js index c4b880f761..acfa654556 100644 --- a/public/src/admin/settings.js +++ b/public/src/admin/settings.js @@ -53,11 +53,11 @@ define('admin/settings', ['uploader', 'sounds'], function(uploader, sounds) { } } } else if (field.is('textarea')) { - if (app.config[key]) { + if (app.config.hasOwnProperty(key)) { field.val(app.config[key]); } } else if (field.is('select')) { - if (app.config[key]) { + if (app.config.hasOwnProperty(key)) { field.val(app.config[key]); } } diff --git a/src/controllers/index.js b/src/controllers/index.js index a1e9c63dae..d5d26ec34e 100644 --- a/src/controllers/index.js +++ b/src/controllers/index.js @@ -31,6 +31,7 @@ var Controllers = { Controllers.home = function(req, res, next) { var route = meta.config.homePageRoute || (meta.config.homePageCustom || '').replace(/^\/+/, '') || 'categories'; + console.log(route, meta.config); user.getSettings(req.uid, function(err, settings) { if (err) {