Merge branch 'develop' into upgrades-refactor

v1.18.x
Julian Lam 8 years ago
commit 1c9cbc3365

@ -20,14 +20,14 @@ module.exports = {
'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 || !settings) {
var keys = ['chat-incoming', 'chat-outgoing', 'notification']; return callback(err);
}
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) {
@ -36,29 +36,29 @@ module.exports = {
}); });
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) { batch.processSortedSet('users:joindate', function (ids, next) {
async.each(ids, function (uid, next) { async.each(ids, function (uid, next) {
user.getSettings(uid, function (err, settings) { user.getSettings(uid, function (err, settings) {
if (err) { if (err) {
return next(err); return next(err);
}
keys.forEach(function (key) {
if (settings[key] && settings[key].indexOf(' | ') === -1) {
settings[key] = map[settings[key]] || '';
} }
});
user.saveSettings(uid, settings, next); keys.forEach(function (key) {
}); if (settings[key] && settings[key].indexOf(' | ') === -1) {
}, next); settings[key] = map[settings[key]] || '';
}, cb); }
}, });
], callback);
user.saveSettings(uid, settings, next);
});
}, next);
}, cb);
},
], callback);
});
}, },
}; };

Loading…
Cancel
Save