Skip to content

Node.js based forum software built for the modern web

linting for tests to pass

Julian Lama2662f8b6969
diff --git a/src/upgrade.js b/src/upgrade.js
index 0f7e55c438..00f599fbdb 100644
--- a/src/upgrade.js
+++ b/src/upgrade.js
@@ -59,6 +59,10 @@ Upgrade.check = function (callback) {
}, []);
db.getSortedSetRange('schemaLog', 0, -1, function (err, executed) {
+ if (err) {
+ return callback(err);
+ }
+
var remainder = all.filter(function (name) {
return executed.indexOf(name) === -1;
});
diff --git a/src/upgrades/category_recent_tids.js b/src/upgrades/category_recent_tids.js
index ccb6f5c818..18d27266f6 100644
--- a/src/upgrades/category_recent_tids.js
+++ b/src/upgrades/category_recent_tids.js
@@ -1,10 +1,10 @@
/* jslint node: true */
+
'use strict';
var db = require('../database');
var async = require('async');
-var winston = require('winston');
module.exports = {
name: 'Category recent tids',
@@ -29,5 +29,5 @@ module.exports = {
});
}, callback);
});
- }
-};
\ No newline at end of file
+ },
+};
diff --git a/src/upgrades/favourites_to_bookmarks.js b/src/upgrades/favourites_to_bookmarks.js
index 288d32c511..05b1e5b5f9 100644
--- a/src/upgrades/favourites_to_bookmarks.js
+++ b/src/upgrades/favourites_to_bookmarks.js
@@ -1,10 +1,10 @@
/* jslint node: true */
+
'use strict';
var db = require('../database');
var async = require('async');
-var winston = require('winston');
module.exports = {
name: 'Favourites to Bookmarks',
@@ -31,7 +31,7 @@ module.exports = {
},
function (next) {
db.deleteObjectField('post:' + id, 'reputation', next);
- }
+ },
], next);
}, next);
}, {}, next);
@@ -48,5 +48,5 @@ module.exports = {
}
async.series([upgradePosts, upgradeUsers], callback);
- }
-};
\ No newline at end of file
+ },
+};
diff --git a/src/upgrades/flags_refactor.js b/src/upgrades/flags_refactor.js
index c61a3a4747..deb1befc6c 100644
--- a/src/upgrades/flags_refactor.js
+++ b/src/upgrades/flags_refactor.js
@@ -1,4 +1,5 @@
/* jslint node: true */
+
'use strict';
var db = require('../database');
@@ -12,7 +13,6 @@ module.exports = {
var batch = require('../batch');
var posts = require('../posts');
var flags = require('../flags');
- var migrated = 0;
batch.processSortedSet('posts:pid', function (ids, next) {
posts.getPostsByPids(ids, 1, function (err, posts) {
@@ -23,11 +23,11 @@ module.exports = {
posts = posts.filter(function (post) {
return post.hasOwnProperty('flags');
});
-
+
async.each(posts, function (post, next) {
async.parallel({
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) {
if (err) {
return next(err);
@@ -51,7 +51,7 @@ module.exports = {
flags.update(flagObj.flagId, 1, {
state: post['flag:state'],
assignee: post['flag:assignee'],
- datetime: datetime
+ datetime: datetime,
}, next);
} else {
setImmediate(next);
@@ -72,7 +72,7 @@ module.exports = {
} else {
setImmediate(next);
}
- }
+ },
], function (err) {
if (err && err.message === '[[error:already-flagged]]') {
// Already flagged, no need to parse, but not an error
@@ -85,5 +85,5 @@ module.exports = {
}, next);
});
}, callback);
- }
-};
\ No newline at end of file
+ },
+};
diff --git a/src/upgrades/global_and_user_language_keys.js b/src/upgrades/global_and_user_language_keys.js
index d08b3fea74..14f71c1fce 100644
--- a/src/upgrades/global_and_user_language_keys.js
+++ b/src/upgrades/global_and_user_language_keys.js
@@ -1,10 +1,10 @@
/* jslint node: true */
+
'use strict';
var db = require('../database');
var async = require('async');
-var winston = require('winston');
module.exports = {
name: 'Update global and user language keys',
@@ -14,8 +14,6 @@ module.exports = {
var meta = require('../meta');
var batch = require('../batch');
var newLanguage;
- var i = 0;
- var j = 0;
async.parallel([
function (next) {
meta.configs.get('defaultLang', function (err, defaultLang) {
@@ -41,23 +39,21 @@ module.exports = {
async.waterfall([
async.apply(db.getObjectField, 'user:' + uid + ':settings', 'userLang'),
function (language, next) {
- ++i;
if (!language) {
return setImmediate(next);
}
newLanguage = language.replace('_', '-').replace('@', '-x-');
if (newLanguage !== language) {
- ++j;
user.setSetting(uid, 'userLang', newLanguage, next);
} else {
setImmediate(next);
}
- }
+ },
], next);
}, next);
}, next);
- }
+ },
], callback);
- }
-};
\ No newline at end of file
+ },
+};
diff --git a/src/upgrades/sorted_set_for_pinned_topics.js b/src/upgrades/sorted_set_for_pinned_topics.js
index d10a6ee902..faa12f3cc8 100644
--- a/src/upgrades/sorted_set_for_pinned_topics.js
+++ b/src/upgrades/sorted_set_for_pinned_topics.js
@@ -1,4 +1,5 @@
/* jslint node: true */
+
'use strict';
var db = require('../database');
@@ -28,10 +29,10 @@ module.exports = {
async.parallel([
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:posts', topicData.tid)
+ async.apply(db.sortedSetRemove, 'cid:' + topicData.cid + ':tids:posts', topicData.tid),
], next);
}, next);
});
}, callback);
- }
-};
\ No newline at end of file
+ },
+};
diff --git a/src/upgrades/sorted_sets_for_post_replies.js b/src/upgrades/sorted_sets_for_post_replies.js
index 7442b614d4..78fc96c7a1 100644
--- a/src/upgrades/sorted_sets_for_post_replies.js
+++ b/src/upgrades/sorted_sets_for_post_replies.js
@@ -1,4 +1,5 @@
/* jslint node: true */
+
'use strict';
var db = require('../database');
@@ -25,10 +26,10 @@ module.exports = {
winston.verbose('processing pid: ' + postData.pid + ' toPid: ' + postData.toPid);
async.parallel([
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);
});
}, callback);
- }
-};
\ No newline at end of file
+ },
+};