posts.getPostsByTid and posts.getPostsByPids now require a uid passed in

v1.18.x
psychobunny 11 years ago
parent c1f3b94d67
commit 45383ce21e

@ -94,7 +94,7 @@ var async = require('async'),
], callback); ], callback);
}; };
Posts.getPostsByTid = function(tid, set, start, end, reverse, callback) { Posts.getPostsByTid = function(tid, set, start, end, uid, reverse, callback) {
Posts.getPidsFromSet(set, start, end, reverse, function(err, pids) { Posts.getPidsFromSet(set, start, end, reverse, function(err, pids) {
if(err) { if(err) {
return callback(err); return callback(err);
@ -104,7 +104,7 @@ var async = require('async'),
return callback(null, []); return callback(null, []);
} }
Posts.getPostsByPids(pids, callback); Posts.getPostsByPids(pids, uid, callback);
}); });
}; };
@ -115,7 +115,7 @@ var async = require('async'),
db[reverse ? 'getSortedSetRevRange' : 'getSortedSetRange'](set, start, end, callback); db[reverse ? 'getSortedSetRevRange' : 'getSortedSetRange'](set, start, end, callback);
}; };
Posts.getPostsByPids = function(pids, callback) { Posts.getPostsByPids = function(pids, uid, callback) {
var keys = []; var keys = [];
for(var x=0, numPids=pids.length; x<numPids; ++x) { for(var x=0, numPids=pids.length; x<numPids; ++x) {

@ -262,7 +262,7 @@ var async = require('async'),
if (!pids.length) { if (!pids.length) {
return next(null, []); return next(null, []);
} }
posts.getPostsByPids(pids, function(err, posts) { posts.getPostsByPids(pids, uid, function(err, posts) {
if (err) { if (err) {
return next(err); return next(err);
} }
@ -323,7 +323,7 @@ var async = require('async'),
return topic ? topic.mainPid : null; return topic ? topic.mainPid : null;
}); });
posts.getPostsByPids(mainPids, function(err, postData) { posts.getPostsByPids(mainPids, uid, function(err, postData) {
if (err) { if (err) {
return callback(err); return callback(err);
} }

@ -24,7 +24,7 @@ module.exports = function(Topics) {
Topics.getTopicPosts = function(tid, set, start, end, uid, reverse, callback) { Topics.getTopicPosts = function(tid, set, start, end, uid, reverse, callback) {
callback = callback || function() {}; callback = callback || function() {};
posts.getPostsByTid(tid, set, start, end, reverse, function(err, postData) { posts.getPostsByTid(tid, set, start, end, uid, reverse, function(err, postData) {
if(err) { if(err) {
return callback(err); return callback(err);
} }

Loading…
Cancel
Save