From 866d8132184d1d59c0dcb031c4111a7fe9dceb20 Mon Sep 17 00:00:00 2001 From: Baris Usakli Date: Thu, 21 Nov 2013 15:33:41 -0500 Subject: [PATCH] fixed topic posting bug, if there was only 1 topic in a category the next posted topic in that category wasnt showing up until a full page reload --- public/src/forum/category.js | 9 ++++++--- public/src/forum/topic.js | 5 +++-- public/templates/topic.tpl | 2 +- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/public/src/forum/category.js b/public/src/forum/category.js index dba77b74f9..6faf331f43 100644 --- a/public/src/forum/category.js +++ b/public/src/forum/category.js @@ -94,17 +94,20 @@ define(function () { if (numTopics > 0) { for (var x = 0; x < numTopics; x++) { - if ($(topics[x]).find('.icon-pushpin').length) + if ($(topics[x]).find('.icon-pushpin').length) { + if(x === numTopics - 1) { + topic.insertAfter(topics[x]); + } continue; + } topic.insertBefore(topics[x]); - topic.hide().fadeIn('slow'); break; } } else { container.append(topic); - topic.hide().fadeIn('slow'); } + topic.hide().fadeIn('slow'); socket.emit('api:categories.getRecentReplies', templates.get('category_id')); addActiveUser(data); diff --git a/public/src/forum/topic.js b/public/src/forum/topic.js index 4ee458b501..f0133be07c 100644 --- a/public/src/forum/topic.js +++ b/public/src/forum/topic.js @@ -34,8 +34,9 @@ define(function() { app.enter_room('topic_' + tid); - if($('#post-container .sub-posts').length) - $('.topic-main-buttons').removeClass('hide'); + if($('#post-container .sub-posts').length) { + $('.topic-main-buttons').removeClass('hide').parent().removeClass('hide'); + } $('.twitter-share').on('click', function () { window.open(twitter_url, '_blank', 'width=550,height=420,scrollbars=no,status=no'); diff --git a/public/templates/topic.tpl b/public/templates/topic.tpl index ae5a301a2b..f5fb740ad2 100644 --- a/public/templates/topic.tpl +++ b/public/templates/topic.tpl @@ -196,7 +196,7 @@ -
+