added filter:topic.thread_tools for creating custom admin functionality in topics view

This commit is contained in:
psychobunny
2014-02-21 16:47:40 -05:00
parent 6f7243f42f
commit 2ec6dd1d14
2 changed files with 20 additions and 2 deletions

View File

@@ -826,7 +826,13 @@ var async = require('async'),
Topics.getPageCount(tid, current_user, next);
}
async.parallel([getTopicData, getTopicPosts, getPrivileges, getCategoryData, getPageCount], function(err, results) {
function getThreadTools(next) {
Plugins.fireHook('filter:topic.thread_tools', [], function(err, threadTools) {
next(err, threadTools);
});
}
async.parallel([getTopicData, getTopicPosts, getPrivileges, getCategoryData, getPageCount, getThreadTools], function(err, results) {
if (err) {
winston.error('[Topics.getTopicWithPosts] Could not retrieve topic data: ', err.message);
return callback(err);
@@ -835,7 +841,8 @@ var async = require('async'),
var topicData = results[0],
privileges = results[2],
categoryData = results[3],
pageCount = results[4];
pageCount = results[4],
threadTools = results[5];
callback(null, {
'topic_name': topicData.title,
@@ -852,6 +859,7 @@ var async = require('async'),
'unreplied': parseInt(topicData.postcount, 10) === 1,
'topic_id': tid,
'expose_tools': privileges.editable ? 1 : 0,
'thread_tools': threadTools,
'disableSocialButtons': meta.config.disableSocialButtons !== undefined ? parseInt(meta.config.disableSocialButtons, 10) !== 0 : false,
'posts': results[1]
});