mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-08 15:05:46 +01:00
fixes posttools.ismain
This commit is contained in:
@@ -19,16 +19,8 @@ var winston = require('winston'),
|
||||
(function(PostTools) {
|
||||
|
||||
PostTools.isMain = function(pid, tid, callback) {
|
||||
db.getSortedSetRange('tid:' + tid + ':posts', 0, 0, function(err, pids) {
|
||||
if(err) {
|
||||
return callback(err);
|
||||
}
|
||||
|
||||
if(!Array.isArray(pids) || !pids.length) {
|
||||
return callback(null, false);
|
||||
}
|
||||
|
||||
callback(null, parseInt(pids[0], 10) === parseInt(pid, 10));
|
||||
topics.getTopicField(tid, 'mainPid', function(err, mainPid) {
|
||||
callback(err, parseInt(pid, 10) === parseInt(mainPid, 10));
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user