From 3ad98f3783fd1b7c0197f6d671eb2b7731779089 Mon Sep 17 00:00:00 2001 From: akhoury Date: Thu, 12 Dec 2013 22:50:49 -0500 Subject: [PATCH] remove uncessary checks in guest config upgrade --- src/upgrade.js | 33 ++++++++------------------------- 1 file changed, 8 insertions(+), 25 deletions(-) diff --git a/src/upgrade.js b/src/upgrade.js index e404bd2855..9876a76a8c 100644 --- a/src/upgrade.js +++ b/src/upgrade.js @@ -305,25 +305,16 @@ Upgrade.upgradeRedis = function(callback) { } }, function(next) { - thisSchemaDate = new Date(2013, 11, 11).getTime(); if (schemaDate < thisSchemaDate) { updatesMade = true; - RDB.hmget('config', 'allowGuestSearching', function(err, value) { - if(err) { + RDB.hset('config', 'allowGuestSearching', '0', function(err){ + if (err) { return next(err); } - - if(value[0] === null) { - RDB.hset('config', 'allowGuestSearching', '0', function(err){ - if (err) { - return next(err); - } - winston.info('[2013/12/11] Updated guest search config.'); - next(); - }); - } + winston.info('[2013/12/11] Updated guest search config.'); + next(); }); } else { winston.info('[2013/12/11] Update to guest search skipped'); @@ -379,20 +370,12 @@ Upgrade.upgradeMongo = function(callback) { if (schemaDate < thisSchemaDate) { updatesMade = true; - db.getObjectField('config', 'allowGuestSearching', function(err, value) { - if(err) { + db.setObjectField('config', 'allowGuestSearching', '0', function(err){ + if (err) { return next(err); } - - if(!value) { - db.setObjectField('config', 'allowGuestSearching', '0', function(err){ - if (err) { - return next(err); - } - winston.info('[2013/12/11] Updated guest search config.'); - next(); - }); - } + winston.info('[2013/12/11] Updated guest search config.'); + next(); }); } else { winston.info('[2013/12/11] Update to guest search skipped');