Skip to content

Node.js based forum software built for the modern web

fixes posttools.ismain

barisusaklibf04749f5e08
diff --git a/src/postTools.js b/src/postTools.js
index 20e8cc272c..f496e640bf 100644
--- a/src/postTools.js
+++ b/src/postTools.js
@@ -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));
});
};