mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-07 06:25:50 +01:00
removed most of the db.sortedSetCards
This commit is contained in:
@@ -77,11 +77,11 @@ var async = require('async'),
|
||||
};
|
||||
|
||||
Topics.getPageCount = function(tid, uid, callback) {
|
||||
db.sortedSetCard('tid:' + tid + ':posts', function(err, postCount) {
|
||||
if(err) {
|
||||
Topics.getTopicField(tid, 'postcount', function(err, postCount) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
if(!parseInt(postCount, 10)) {
|
||||
if (!parseInt(postCount, 10)) {
|
||||
return callback(null, 1);
|
||||
}
|
||||
user.getSettings(uid, function(err, settings) {
|
||||
@@ -346,15 +346,22 @@ var async = require('async'),
|
||||
};
|
||||
|
||||
Topics.getTeasers = function(tids, uid, callback) {
|
||||
if(!Array.isArray(tids) || !tids.length) {
|
||||
if (!Array.isArray(tids) || !tids.length) {
|
||||
return callback(null, []);
|
||||
}
|
||||
|
||||
async.parallel({
|
||||
counts: function(next) {
|
||||
async.map(tids, function(tid, next) {
|
||||
db.sortedSetCard('tid:' + tid + ':posts', next);
|
||||
}, next);
|
||||
Topics.getTopicsFields(tids, ['postcount'], function(err, topics) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
}
|
||||
topics = topics.map(function(topic) {
|
||||
return topic && topic.postcount;
|
||||
});
|
||||
|
||||
next(null, topics);
|
||||
});
|
||||
},
|
||||
pids: function(next) {
|
||||
async.map(tids, function(tid, next) {
|
||||
|
||||
Reference in New Issue
Block a user