diff --git a/src/categories.js b/src/categories.js index 8d15745d9c..3d5b012f53 100644 --- a/src/categories.js +++ b/src/categories.js @@ -31,7 +31,7 @@ Categories.getCategoryById = function (data, callback) { Categories.getCategories([data.cid], data.uid, next); }, function (categories, next) { - if (!Array.isArray(categories) || !categories[0]) { + if (!categories[0]) { return next(new Error('[[error:invalid-cid]]')); } category = categories[0]; diff --git a/src/controllers/topics.js b/src/controllers/topics.js index 4b7fce05e8..eb69d48222 100644 --- a/src/controllers/topics.js +++ b/src/controllers/topics.js @@ -314,7 +314,7 @@ topicsController.teaser = function (req, res, next) { posts.getPostSummaryByPids([pid], req.uid, { stripTags: false }, next); }, function (posts) { - if (!Array.isArray(posts) || !posts.length) { + if (!posts.length) { return res.status(404).json('not-found'); } res.json(posts[0]); diff --git a/src/groups/delete.js b/src/groups/delete.js index 260c4ad381..4d5fa6b4c0 100644 --- a/src/groups/delete.js +++ b/src/groups/delete.js @@ -14,7 +14,7 @@ module.exports = function (Groups) { Groups.getGroupsData([groupName], next); }, function (groupsData, next) { - if (!Array.isArray(groupsData) || !groupsData[0]) { + if (!groupsData[0]) { return callback(); } groupObj = groupsData[0]; diff --git a/src/notifications.js b/src/notifications.js index fb55cd8ab3..eb9820a952 100644 --- a/src/notifications.js +++ b/src/notifications.js @@ -363,10 +363,6 @@ Notifications.markAllRead = function (uid, callback) { db.getSortedSetRevRange('uid:' + uid + ':notifications:unread', 0, 99, next); }, function (nids, next) { - if (!Array.isArray(nids) || !nids.length) { - return next(); - } - Notifications.markReadMultiple(nids, uid, next); }, ], callback); diff --git a/src/topics.js b/src/topics.js index 12632193fb..b96c76f5de 100644 --- a/src/topics.js +++ b/src/topics.js @@ -235,7 +235,7 @@ var social = require('./social'); posts.getPidsFromSet(set, start, stop, reverse, next); }, function (pids, next) { - if ((!Array.isArray(pids) || !pids.length) && !topic.mainPid) { + if (!pids.length && !topic.mainPid) { return callback(null, []); } diff --git a/src/topics/follow.js b/src/topics/follow.js index 494872c794..6ca4b61625 100644 --- a/src/topics/follow.js +++ b/src/topics/follow.js @@ -200,16 +200,10 @@ module.exports = function (Topics) { Topics.getFollowers(postData.topic.tid, next); }, function (followers, next) { - if (!Array.isArray(followers) || !followers.length) { - return callback(); - } var index = followers.indexOf(exceptUid.toString()); if (index !== -1) { followers.splice(index, 1); } - if (!followers.length) { - return callback(); - } privileges.topics.filterUids('read', postData.topic.tid, followers, next); }, diff --git a/src/user/notifications.js b/src/user/notifications.js index e8873c88f2..4e2dcba7e8 100644 --- a/src/user/notifications.js +++ b/src/user/notifications.js @@ -271,9 +271,6 @@ UserNotifications.sendTopicNotificationToFollowers = function (uid, topicData, p db.getSortedSetRange('followers:' + uid, 0, -1, next); }, function (followers, next) { - if (!Array.isArray(followers) || !followers.length) { - return; - } privileges.categories.filterUids('read', topicData.cid, followers, next); }, function (_followers, next) {