Skip to content

Node.js based forum software built for the modern web

fix post-bar and post count

barisusakli2a6f411effe6
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();
}
};