From 8484c7c51a8ee976227c17547fd3fcf3399ccac2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Wed, 11 Mar 2015 12:07:40 -0400 Subject: [PATCH] closes #2850 --- public/src/client/recent.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/public/src/client/recent.js b/public/src/client/recent.js index bdf8897151..05e936a577 100644 --- a/public/src/client/recent.js +++ b/public/src/client/recent.js @@ -2,7 +2,7 @@ /* globals define, app, socket, utils */ -define('forum/recent', ['forum/infinitescroll'], function(infinitescroll) { +define('forum/recent', ['forum/infinitescroll', 'composer'], function(infinitescroll, composer) { var Recent = {}; var newTopicCount = 0, @@ -23,6 +23,17 @@ define('forum/recent', ['forum/infinitescroll'], function(infinitescroll) { $(this).addClass('hide'); }); + $('#new_topic').on('click', function() { + socket.emit('categories.getCategoriesByPrivilege', 'topics:create', function(err, categories) { + if (err) { + return app.alertError(err.message); + } + if (categories.length) { + composer.newTopic(categories[0].cid); + } + }); + }); + infinitescroll.init(Recent.loadMoreTopics); };