mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-07 22:45:46 +01:00
style changes
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user