Merge branch 'master' into develop

This commit is contained in:
Julian Lam
2017-02-27 12:15:48 -05:00

View File

@@ -425,14 +425,17 @@ Upgrade.upgrade = function (callback) {
'waterdrop-low.mp3': 'Default | Water drop (low)',
};
async.parallel([
function (cb) {
var keys = ['chat-incoming', 'chat-outgoing', 'notification'];
db.getObject('settings:sounds', function (err, settings) {
if (err) {
return next(err);
} else if (!settings) {
winston.info(schemaName + ' - done');
return Upgrade.update(thisSchemaDate, next);
}
db.getObject('settings:sounds', function (err, settings) {
if (err || !settings) {
return cb(err);
}
async.parallel([
function (cb) {
var keys = ['chat-incoming', 'chat-outgoing', 'notification'];
keys.forEach(function (key) {
if (settings[key] && settings[key].indexOf(' | ') === -1) {
@@ -441,38 +444,38 @@ Upgrade.upgrade = function (callback) {
});
meta.configs.setMultiple(settings, cb);
});
},
function (cb) {
var keys = ['notificationSound', 'incomingChatSound', 'outgoingChatSound'];
},
function (cb) {
var keys = ['notificationSound', 'incomingChatSound', 'outgoingChatSound'];
batch.processSortedSet('users:joindate', function (ids, next) {
async.each(ids, function (uid, next) {
user.getSettings(uid, function (err, settings) {
if (err) {
return next(err);
}
keys.forEach(function (key) {
if (settings[key] && settings[key].indexOf(' | ') === -1) {
settings[key] = map[settings[key]] || '';
batch.processSortedSet('users:joindate', function (ids, next) {
async.each(ids, function (uid, next) {
user.getSettings(uid, function (err, settings) {
if (err) {
return next(err);
}
});
user.saveSettings(uid, settings, next);
});
}, next);
}, cb);
},
], function (err) {
if (err) {
return next(err);
}
winston.verbose(schemaName + ' - done');
Upgrade.update(thisSchemaDate, next);
keys.forEach(function (key) {
if (settings[key] && settings[key].indexOf(' | ') === -1) {
settings[key] = map[settings[key]] || '';
}
});
user.saveSettings(uid, settings, next);
});
}, next);
}, cb);
},
], function (err) {
if (err) {
return next(err);
}
winston.info(schemaName + ' - done');
Upgrade.update(thisSchemaDate, next);
});
});
} else {
winston.verbose(schemaName + ' - skipped!');
winston.info(schemaName + ' - skipped!');
next();
}
},