From f905c588777bc94d3355635ec7ed04f23ca34974 Mon Sep 17 00:00:00 2001 From: reality Date: Mon, 22 Apr 2013 14:46:30 +0000 Subject: [PATCH] Fix setconfig, showconfig and pushconfig from being confused by false values [#331] --- modules/admin/admin.js | 3 +-- modules/admin/commands.js | 6 +++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/modules/admin/admin.js b/modules/admin/admin.js index ce8d73a..d596e51 100644 --- a/modules/admin/admin.js +++ b/modules/admin/admin.js @@ -12,7 +12,6 @@ var admin = function(dbot) { if(configKey) { this.db.read('config', configKey, function(err, cRecord) { if(cRecord) { - console.log('record found'); callback(cRecord.value) } else { var configPath = dbot.config; @@ -22,7 +21,7 @@ var admin = function(dbot) { if(_.has(configPath, configKey[i])) { configPath = configPath[configKey[i]]; } else { - callback(false); + callback(null); break; } } diff --git a/modules/admin/commands.js b/modules/admin/commands.js index a0dae29..e7172ba 100644 --- a/modules/admin/commands.js +++ b/modules/admin/commands.js @@ -156,7 +156,7 @@ var commands = function(dbot) { if(!_.include(noChangeConfig, configPath)) { this.internalAPI.getCurrentConfig(configPath, function(config) { - if(config) { + if(config !== null) { // Convert to boolean type if config item boolean if(_.isBoolean(config)) { newOption = (newOption == "true"); @@ -185,7 +185,7 @@ var commands = function(dbot) { if(!_.include(noChangeConfig, configPath)) { this.internalAPI.getCurrentConfig(configPath, function(config) { - if(config) { + if(config !== null) { if(_.isArray(config)) { event.reply(configPath + ": " + config + " << " + newOption); config.push(newOption); @@ -211,7 +211,7 @@ var commands = function(dbot) { var configPath = event.params[1]; if(configPath) { this.internalAPI.getCurrentConfig(configPath, function(config) { - if(config) { + if(config !== null) { if(_.isArray(config)) { event.reply('Config keys in ' + configPath + ': ' + config); } else if(_.isObject(config)) {