linting for tests to pass

v1.18.x
Julian Lam 8 years ago
parent d75cc60e76
commit a2662f8b69

@ -59,6 +59,10 @@ Upgrade.check = function (callback) {
}, []); }, []);
db.getSortedSetRange('schemaLog', 0, -1, function (err, executed) { db.getSortedSetRange('schemaLog', 0, -1, function (err, executed) {
if (err) {
return callback(err);
}
var remainder = all.filter(function (name) { var remainder = all.filter(function (name) {
return executed.indexOf(name) === -1; return executed.indexOf(name) === -1;
}); });

@ -1,10 +1,10 @@
/* jslint node: true */ /* jslint node: true */
'use strict'; 'use strict';
var db = require('../database'); var db = require('../database');
var async = require('async'); var async = require('async');
var winston = require('winston');
module.exports = { module.exports = {
name: 'Category recent tids', name: 'Category recent tids',
@ -29,5 +29,5 @@ module.exports = {
}); });
}, callback); }, callback);
}); });
} },
}; };

@ -1,10 +1,10 @@
/* jslint node: true */ /* jslint node: true */
'use strict'; 'use strict';
var db = require('../database'); var db = require('../database');
var async = require('async'); var async = require('async');
var winston = require('winston');
module.exports = { module.exports = {
name: 'Favourites to Bookmarks', name: 'Favourites to Bookmarks',
@ -31,7 +31,7 @@ module.exports = {
}, },
function (next) { function (next) {
db.deleteObjectField('post:' + id, 'reputation', next); db.deleteObjectField('post:' + id, 'reputation', next);
} },
], next); ], next);
}, next); }, next);
}, {}, next); }, {}, next);
@ -48,5 +48,5 @@ module.exports = {
} }
async.series([upgradePosts, upgradeUsers], callback); async.series([upgradePosts, upgradeUsers], callback);
} },
}; };

@ -1,4 +1,5 @@
/* jslint node: true */ /* jslint node: true */
'use strict'; 'use strict';
var db = require('../database'); var db = require('../database');
@ -12,7 +13,6 @@ module.exports = {
var batch = require('../batch'); var batch = require('../batch');
var posts = require('../posts'); var posts = require('../posts');
var flags = require('../flags'); var flags = require('../flags');
var migrated = 0;
batch.processSortedSet('posts:pid', function (ids, next) { batch.processSortedSet('posts:pid', function (ids, next) {
posts.getPostsByPids(ids, 1, function (err, posts) { posts.getPostsByPids(ids, 1, function (err, posts) {
@ -27,7 +27,7 @@ module.exports = {
async.each(posts, function (post, next) { async.each(posts, function (post, next) {
async.parallel({ async.parallel({
uids: async.apply(db.getSortedSetRangeWithScores, 'pid:' + post.pid + ':flag:uids', 0, -1), uids: async.apply(db.getSortedSetRangeWithScores, 'pid:' + post.pid + ':flag:uids', 0, -1),
reasons: async.apply(db.getSortedSetRange, 'pid:' + post.pid + ':flag:uid:reason', 0, -1) reasons: async.apply(db.getSortedSetRange, 'pid:' + post.pid + ':flag:uid:reason', 0, -1),
}, function (err, data) { }, function (err, data) {
if (err) { if (err) {
return next(err); return next(err);
@ -51,7 +51,7 @@ module.exports = {
flags.update(flagObj.flagId, 1, { flags.update(flagObj.flagId, 1, {
state: post['flag:state'], state: post['flag:state'],
assignee: post['flag:assignee'], assignee: post['flag:assignee'],
datetime: datetime datetime: datetime,
}, next); }, next);
} else { } else {
setImmediate(next); setImmediate(next);
@ -72,7 +72,7 @@ module.exports = {
} else { } else {
setImmediate(next); setImmediate(next);
} }
} },
], function (err) { ], function (err) {
if (err && err.message === '[[error:already-flagged]]') { if (err && err.message === '[[error:already-flagged]]') {
// Already flagged, no need to parse, but not an error // Already flagged, no need to parse, but not an error
@ -85,5 +85,5 @@ module.exports = {
}, next); }, next);
}); });
}, callback); }, callback);
} },
}; };

@ -1,10 +1,10 @@
/* jslint node: true */ /* jslint node: true */
'use strict'; 'use strict';
var db = require('../database'); var db = require('../database');
var async = require('async'); var async = require('async');
var winston = require('winston');
module.exports = { module.exports = {
name: 'Update global and user language keys', name: 'Update global and user language keys',
@ -14,8 +14,6 @@ module.exports = {
var meta = require('../meta'); var meta = require('../meta');
var batch = require('../batch'); var batch = require('../batch');
var newLanguage; var newLanguage;
var i = 0;
var j = 0;
async.parallel([ async.parallel([
function (next) { function (next) {
meta.configs.get('defaultLang', function (err, defaultLang) { meta.configs.get('defaultLang', function (err, defaultLang) {
@ -41,23 +39,21 @@ module.exports = {
async.waterfall([ async.waterfall([
async.apply(db.getObjectField, 'user:' + uid + ':settings', 'userLang'), async.apply(db.getObjectField, 'user:' + uid + ':settings', 'userLang'),
function (language, next) { function (language, next) {
++i;
if (!language) { if (!language) {
return setImmediate(next); return setImmediate(next);
} }
newLanguage = language.replace('_', '-').replace('@', '-x-'); newLanguage = language.replace('_', '-').replace('@', '-x-');
if (newLanguage !== language) { if (newLanguage !== language) {
++j;
user.setSetting(uid, 'userLang', newLanguage, next); user.setSetting(uid, 'userLang', newLanguage, next);
} else { } else {
setImmediate(next); setImmediate(next);
} }
} },
], next); ], next);
}, next); }, next);
}, next); }, next);
} },
], callback); ], callback);
} },
}; };

@ -1,4 +1,5 @@
/* jslint node: true */ /* jslint node: true */
'use strict'; 'use strict';
var db = require('../database'); var db = require('../database');
@ -28,10 +29,10 @@ module.exports = {
async.parallel([ async.parallel([
async.apply(db.sortedSetAdd, 'cid:' + topicData.cid + ':tids:pinned', Date.now(), topicData.tid), async.apply(db.sortedSetAdd, 'cid:' + topicData.cid + ':tids:pinned', Date.now(), topicData.tid),
async.apply(db.sortedSetRemove, 'cid:' + topicData.cid + ':tids', topicData.tid), async.apply(db.sortedSetRemove, 'cid:' + topicData.cid + ':tids', topicData.tid),
async.apply(db.sortedSetRemove, 'cid:' + topicData.cid + ':tids:posts', topicData.tid) async.apply(db.sortedSetRemove, 'cid:' + topicData.cid + ':tids:posts', topicData.tid),
], next); ], next);
}, next); }, next);
}); });
}, callback); }, callback);
} },
}; };

@ -1,4 +1,5 @@
/* jslint node: true */ /* jslint node: true */
'use strict'; 'use strict';
var db = require('../database'); var db = require('../database');
@ -25,10 +26,10 @@ module.exports = {
winston.verbose('processing pid: ' + postData.pid + ' toPid: ' + postData.toPid); winston.verbose('processing pid: ' + postData.pid + ' toPid: ' + postData.toPid);
async.parallel([ async.parallel([
async.apply(db.sortedSetAdd, 'pid:' + postData.toPid + ':replies', postData.timestamp, postData.pid), async.apply(db.sortedSetAdd, 'pid:' + postData.toPid + ':replies', postData.timestamp, postData.pid),
async.apply(db.incrObjectField, 'post:' + postData.toPid, 'replies') async.apply(db.incrObjectField, 'post:' + postData.toPid, 'replies'),
], next); ], next);
}, next); }, next);
}); });
}, callback); }, callback);
} },
}; };
Loading…
Cancel
Save