remove unnecessary checks

This commit is contained in:
Barış Soner Uşaklı
2017-05-27 00:30:07 -04:00
parent 6a742ead38
commit f1b8492164
12 changed files with 29 additions and 40 deletions

View File

@@ -125,16 +125,16 @@ function getNotificationsFromSet(set, read, uid, start, stop, callback) {
db.getSortedSetRevRange(set, start, stop, next);
},
function (nids, next) {
if (!Array.isArray(nids) || !nids.length) {
return callback(null, []);
}
UserNotifications.getNotifications(nids, uid, next);
},
], callback);
}
UserNotifications.getNotifications = function (nids, uid, callback) {
if (!Array.isArray(nids) || !nids.length) {
return callback(null, []);
}
var notificationData = [];
async.waterfall([
function (next) {
@@ -177,10 +177,6 @@ UserNotifications.getDailyUnread = function (uid, callback) {
db.getSortedSetRevRangeByScore('uid:' + uid + ':notifications:unread', 0, 20, '+inf', yesterday, next);
},
function (nids, next) {
if (!Array.isArray(nids) || !nids.length) {
return callback(null, []);
}
UserNotifications.getNotifications(nids, uid, next);
},
], callback);
@@ -231,7 +227,7 @@ UserNotifications.getUnreadByField = function (uid, field, values, callback) {
},
function (_nids, next) {
nids = _nids;
if (!Array.isArray(nids) || !nids.length) {
if (!nids.length) {
return callback(null, []);
}