style changes

This commit is contained in:
Barış Soner Uşaklı
2017-05-26 00:02:20 -04:00
parent 8db193ff55
commit f6ac92111b
32 changed files with 846 additions and 815 deletions

View File

@@ -326,30 +326,31 @@ module.exports = function (Topics) {
}));
}
async.parallel({
recentScores: function (next) {
db.sortedSetScores('topics:recent', tids, next);
async.waterfall([
function (next) {
async.parallel({
recentScores: function (next) {
db.sortedSetScores('topics:recent', tids, next);
},
userScores: function (next) {
db.sortedSetScores('uid:' + uid + ':tids_read', tids, next);
},
tids_unread: function (next) {
db.sortedSetScores('uid:' + uid + ':tids_unread', tids, next);
},
}, next);
},
userScores: function (next) {
db.sortedSetScores('uid:' + uid + ':tids_read', tids, next);
},
tids_unread: function (next) {
db.sortedSetScores('uid:' + uid + ':tids_unread', tids, next);
},
}, function (err, results) {
if (err) {
return callback(err);
}
function (results, next) {
var cutoff = Topics.unreadCutoff();
var result = tids.map(function (tid, index) {
return !results.tids_unread[index] &&
(results.recentScores[index] < cutoff ||
!!(results.userScores[index] && results.userScores[index] >= results.recentScores[index]));
});
var cutoff = Topics.unreadCutoff();
var result = tids.map(function (tid, index) {
return !results.tids_unread[index] &&
(results.recentScores[index] < cutoff ||
!!(results.userScores[index] && results.userScores[index] >= results.recentScores[index]));
});
callback(null, result);
});
next(null, result);
},
], callback);
};
Topics.hasReadTopic = function (tid, uid, callback) {