mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-03-05 12:01:17 +01:00
closes #2515
This commit is contained in:
26
src/posts.js
26
src/posts.js
@@ -16,6 +16,7 @@ var async = require('async'),
|
||||
require('./posts/create')(Posts);
|
||||
require('./posts/delete')(Posts);
|
||||
require('./posts/user')(Posts);
|
||||
require('./posts/topics')(Posts);
|
||||
require('./posts/category')(Posts);
|
||||
require('./posts/summary')(Posts);
|
||||
require('./posts/recent')(Posts);
|
||||
@@ -25,20 +26,6 @@ var async = require('async'),
|
||||
db.isSortedSetMember('posts:pid', pid, callback);
|
||||
};
|
||||
|
||||
Posts.getPostsByTid = function(tid, set, start, end, uid, reverse, callback) {
|
||||
Posts.getPidsFromSet(set, start, end, reverse, function(err, pids) {
|
||||
if(err) {
|
||||
return callback(err);
|
||||
}
|
||||
|
||||
if(!Array.isArray(pids) || !pids.length) {
|
||||
return callback(null, []);
|
||||
}
|
||||
|
||||
Posts.getPostsByPids(pids, uid, callback);
|
||||
});
|
||||
};
|
||||
|
||||
Posts.getPidsFromSet = function(set, start, end, reverse, callback) {
|
||||
if (isNaN(start) || isNaN(end)) {
|
||||
return callback(null, []);
|
||||
@@ -243,17 +230,6 @@ var async = require('async'),
|
||||
});
|
||||
};
|
||||
|
||||
Posts.isMain = function(pid, callback) {
|
||||
Posts.getPostField(pid, 'tid', function(err, tid) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
topics.getTopicField(tid, 'mainPid', function(err, mainPid) {
|
||||
callback(err, parseInt(pid, 10) === parseInt(mainPid, 10));
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
Posts.updatePostVoteCount = function(pid, voteCount, callback) {
|
||||
async.parallel([
|
||||
function(next) {
|
||||
|
||||
Reference in New Issue
Block a user