diff --git a/src/topics.js b/src/topics.js index 3ec8604685..d453dce3e2 100644 --- a/src/topics.js +++ b/src/topics.js @@ -272,28 +272,25 @@ var async = require('async'), }; Topics.getTopicWithPosts = function(tid, uid, start, end, callback) { - threadTools.exists(tid, function(err, exists) { - if (err || !exists) { + Topics.getTopicData(tid, function(err, topicData) { + if (err || !topicData) { return callback(err || new Error('Topic tid \'' + tid + '\' not found')); } async.parallel({ - topicData : function(next) { - Topics.getTopicData(tid, next); - }, - posts : function(next) { + posts: function(next) { Topics.getTopicPosts(tid, start, end, uid, false, next); }, - privileges : function(next) { + privileges: function(next) { threadTools.privileges(tid, uid, next); }, - category : function(next) { + category: function(next) { Topics.getCategoryData(tid, next); }, - pageCount : function(next) { + pageCount: function(next) { Topics.getPageCount(tid, uid, next); }, - threadTools : function(next) { + threadTools: function(next) { plugins.fireHook('filter:topic.thread_tools', [], next); } }, function(err, results) { @@ -301,7 +298,6 @@ var async = require('async'), return callback(err); } - var topicData = results.topicData; topicData.category = results.category; topicData.posts = results.posts; topicData.thread_tools = results.threadTools; diff --git a/src/topics/create.js b/src/topics/create.js index 7b765c5f81..c7c9e53572 100644 --- a/src/topics/create.js +++ b/src/topics/create.js @@ -2,15 +2,12 @@ 'use strict'; var async = require('async'), - db = require('./../database'), - utils = require('./../../public/src/utils'), plugins = require('./../plugins'), user = require('./../user'), meta = require('./../meta'), posts = require('./../posts'), - threadTools = require('./../threadTools'), categoryTools = require('./../categoryTools');