Node.js based forum software built for the modern web
closes #6044
Barış Soner Uşaklı9eabb1dc9415
diff --git a/package.default.json b/package.default.jsonindex bf8cb42f2a..af704b280b 100644--- a/package.default.json+++ b/package.default.json@@ -67,9 +67,9 @@"nodebb-plugin-spam-be-gone": "0.5.1","nodebb-rewards-essentials": "0.0.9","nodebb-theme-lavender": "5.0.0",- "nodebb-theme-persona": "7.0.0",+ "nodebb-theme-persona": "7.0.1","nodebb-theme-slick": "1.1.1",- "nodebb-theme-vanilla": "8.0.0",+ "nodebb-theme-vanilla": "8.0.1","nodebb-widget-essentials": "4.0.0","nodemailer": "4.3.0","passport": "^0.4.0",diff --git a/public/src/client/category.js b/public/src/client/category.jsindex 69bb615b75..0dce7f869c 100644--- a/public/src/client/category.js+++ b/public/src/client/category.js@@ -6,14 +6,14 @@ define('forum/category', ['share','navigator','forum/category/tools',+ 'forum/recent','sort','components','translator','topicSelect','forum/pagination','storage',- 'benchpress',-], function (infinitescroll, share, navigator, categoryTools, sort, components, translator, topicSelect, pagination, storage, Benchpress) {+], function (infinitescroll, share, navigator, categoryTools, recent, sort, components, translator, topicSelect, pagination, storage) {var Category = {};$(window).on('action:ajaxify.start', function (ev, data) {@@ -25,8 +25,8 @@ define('forum/category', [});function removeListeners() {- socket.removeListener('event:new_topic', Category.onNewTopic);categoryTools.removeListeners();+ recent.removeListeners();}Category.init = function () {@@ -36,10 +36,8 @@ define('forum/category', [share.addShareHandlers(ajaxify.data.name);- socket.removeListener('event:new_topic', Category.onNewTopic);- socket.on('event:new_topic', Category.onNewTopic);-categoryTools.init(cid);+ recent.watchForNewPosts();sort.handleSort('categoryTopicSort', 'user.setCategorySort', 'category/' + ajaxify.data.slug);@@ -195,72 +193,6 @@ define('forum/category', [}}- Category.onNewTopic = function (topic) {- var cid = ajaxify.data.cid;- if (!topic || parseInt(topic.cid, 10) !== parseInt(cid, 10)) {- return;- }-- $(window).trigger('filter:categories.new_topic', topic);-- var editable = !!$('.thread-tools').length;-- Benchpress.parse('category', 'topics', {- privileges: { editable: editable },- showSelect: editable,- topics: [topic],- template: { category: true },- }, function (html) {- translator.translate(html, function (translatedHTML) {- var topic = $(translatedHTML);- var container = $('[component="category"]');- var topics = $('[component="category/topic"]');- var numTopics = topics.length;-- $('[component="category"]').removeClass('hidden');- $('.category-sidebar').removeClass('hidden');-- var noTopicsWarning = $('#category-no-topics');- if (noTopicsWarning.length) {- noTopicsWarning.remove();- ajaxify.widgets.render('category', window.location.pathname.slice(1));- }-- if (numTopics > 0) {- for (var x = 0; x < numTopics; x += 1) {- var pinned = $(topics[x]).hasClass('pinned');- if (!pinned) {- topic.insertBefore(topics[x]);- break;- }- if (x === numTopics - 1) {- topic.insertAfter(topics[x]);- }- }- } else {- container.append(topic);- }-- topic.hide().fadeIn('slow');-- topic.find('.timeago').timeago();- app.createUserTooltips();- updateTopicCount();-- $(window).trigger('action:categories.new_topic.loaded');- });- });- };-- function updateTopicCount() {- socket.emit('categories.getTopicCount', ajaxify.data.cid, function (err, topicCount) {- if (err) {- return app.alertError(err.message);- }- navigator.setCount(topicCount);- });- }-Category.loadMoreTopics = function (direction) {if (!$('[component="category"]').length || !$('[component="category"]').children().length) {return;