From 74282ffeea64c5f70396cf5376b521d169d1d81a Mon Sep 17 00:00:00 2001 From: barisusakli Date: Tue, 2 Sep 2014 13:23:32 -0400 Subject: [PATCH] removed another unnecessary socket call --- public/src/forum/home.js | 12 ++---------- src/topics/create.js | 2 +- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/public/src/forum/home.js b/public/src/forum/home.js index 461b5a9c8f..c770aceb36 100644 --- a/public/src/forum/home.js +++ b/public/src/forum/home.js @@ -24,16 +24,8 @@ define('forum/home', function() { }; home.onNewPost = function(data) { - - if (data && data.posts && data.posts.length) { - - socket.emit('posts.getCategory', data.posts[0].pid, function(err, cid) { - if (err) { - return; - } - - renderNewPost(cid, data.posts[0]); - }); + if (data && data.posts && data.posts.length && data.posts[0].topic) { + renderNewPost(data.posts[0].topic.cid, data.posts[0]); } }; diff --git a/src/topics/create.js b/src/topics/create.js index 60c41880b1..2feb2ae787 100644 --- a/src/topics/create.js +++ b/src/topics/create.js @@ -215,7 +215,7 @@ module.exports = function(Topics) { }, function(userInfo, next) { postData.user = userInfo[0]; - Topics.getTopicFields(tid, ['tid', 'title', 'slug'], next); + Topics.getTopicFields(tid, ['tid', 'title', 'slug', 'cid'], next); }, function(topicData, next) { topicData.title = validator.escape(topicData.title);