Merge branch 'master' into develop

v1.18.x
Julian Lam 8 years ago
commit 4a851e0a85

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

Loading…
Cancel
Save