mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-05 23:30:36 +01:00
if no term is passed get count
This commit is contained in:
@@ -13,16 +13,16 @@ module.exports = function(Posts) {
|
||||
};
|
||||
|
||||
Posts.getRecentPosts = function(uid, start, stop, term, callback) {
|
||||
var since = terms.day;
|
||||
var min = 0;
|
||||
if (terms[term]) {
|
||||
since = terms[term];
|
||||
min = Date.now() - terms[term];
|
||||
}
|
||||
|
||||
var count = parseInt(stop, 10) === -1 ? stop : stop - start + 1;
|
||||
|
||||
async.waterfall([
|
||||
function(next) {
|
||||
db.getSortedSetRevRangeByScore('posts:pid', start, count, '+inf', Date.now() - since, next);
|
||||
db.getSortedSetRevRangeByScore('posts:pid', start, count, '+inf', min, next);
|
||||
},
|
||||
function(pids, next) {
|
||||
privileges.posts.filter('read', pids, uid, next);
|
||||
|
||||
Reference in New Issue
Block a user