After hundreds of debug processes, I've finally found the function which is used to do that. Here is screenshot:
0_1466761974079_upload-2e28b1a9-aa7b-4274-8c8b-c93717ae9008
Was looking at writing a plugin that adds additional data to the first post. like say a topic status mabye (availabiity/sold out). Would it be best to put that as a topic field item? or post field on the first post? If topic, i think there would need to be additional plugin hooks. if first post, is there an attribute to a post that is passed to the plugin hooks that it is the first? I didn't see one when depuging out the postData
We don't have any attributes stored in the post objects telling if they are the first post in a topic. The way to tell if the post is the first can be done by checking the redis list 'tid:' + tid + ':posts'
.
For example :
function isMainPost(tid, pid, callback) {
RDB.lrange('tid:' + tid + ':posts', 0, 0, function(err, pids) {
if(err) {
return callback(err, null);
}
callback(null, pids[0] === pid);
});
}
We don't have that function yet but we can add that to posts.js.
function isMainPost(tid, pid, callback) {
RDB.lrange('tid:' + tid + ':posts', 0, 0, function(err, pids) {
if(err) {
return callback(err, null);
}
callback(null, pids[0] === pid);
});
}
Kool, looks like there is already a function PostTools.isMain to do that after further investigation. Will see what i can do with that.