From 2a6f411effe6da32fdc86b4f51ea56aceaab512f Mon Sep 17 00:00:00 2001 From: barisusakli Date: Sat, 24 Oct 2015 23:03:12 -0400 Subject: [PATCH] fix post-bar and post count --- public/src/client/topic/events.js | 4 +++- public/src/client/topic/posts.js | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/public/src/client/topic/events.js b/public/src/client/topic/events.js index 47c7f2c328..7dfe57beed 100644 --- a/public/src/client/topic/events.js +++ b/public/src/client/topic/events.js @@ -81,7 +81,7 @@ define('forum/topic/events', [ $('[data-pid="' + data.post.pid + '"] .favouriteCount').html(data.post.reputation).attr('data-favourites', data.post.reputation); } - function onTopicPurged(data) { + function onTopicPurged() { if (ajaxify.data.category && ajaxify.data.category.slug) { ajaxify.go('category/' + ajaxify.data.category.slug, null, true); } @@ -162,6 +162,8 @@ define('forum/topic/events', [ function onPostPurged(pid) { components.get('post', 'pid', pid).fadeOut(500, function() { $(this).remove(); + ajaxify.data.postcount --; + postTools.updatePostCount(ajaxify.data.postcount); posts.showBottomPostBar(); }); diff --git a/public/src/client/topic/posts.js b/public/src/client/topic/posts.js index f77af4189d..02fdfbc26f 100644 --- a/public/src/client/topic/posts.js +++ b/public/src/client/topic/posts.js @@ -230,8 +230,11 @@ define('forum/topic/posts', [ Posts.showBottomPostBar = function() { var mainPost = components.get('post', 'index', 0); - if (!!mainPost.length && $('[component="post"]').length > 1) { + var posts = $('[component="post"]'); + if (!!mainPost.length && posts.length > 1 && $('.post-bar').length < 2) { $('.post-bar').clone().appendTo(mainPost); + } else if (mainPost.length && posts.length < 2) { + mainPost.find('.post-bar').remove(); } };