Skip to content

Node.js based forum software built for the modern web

dont make extra socket call on new post and IS

barisusakli2ec0d3f376af
diff --git a/public/src/client/topic/postTools.js b/public/src/client/topic/postTools.js
index a4ef94d16c..9ae1cb273e 100644
--- a/public/src/client/topic/postTools.js
+++ b/public/src/client/topic/postTools.js
@@ -15,6 +15,8 @@ define('forum/topic/postTools', ['share', 'navigator', 'components', 'translator
share.addShareHandlers(topicName);
addVoteHandler();
+
+ PostTools.updatePostCount(ajaxify.data.postcount);
};
PostTools.toggle = function(pid, isDeleted) {
@@ -28,15 +30,11 @@ define('forum/topic/postTools', ['share', 'navigator', 'components', 'translator
postEl.find('[component="post/purge"]').toggleClass('hidden', !isDeleted);
};
- PostTools.updatePostCount = function() {
- socket.emit('topics.postcount', ajaxify.data.tid, function(err, postCount) {
- if (!err) {
- var postCountEl = components.get('topic/post-count');
- postCountEl.html(postCount).attr('title', postCount);
- utils.makeNumbersHumanReadable(postCountEl);
- navigator.setCount(postCount);
- }
- });
+ PostTools.updatePostCount = function(postCount) {
+ var postCountEl = components.get('topic/post-count');
+ postCountEl.html(postCount).attr('title', postCount);
+ utils.makeNumbersHumanReadable(postCountEl);
+ navigator.setCount(postCount);
};
function addVoteHandler() {
diff --git a/public/src/client/topic/posts.js b/public/src/client/topic/posts.js
index c9f25760b5..784a11c4a4 100644
--- a/public/src/client/topic/posts.js
+++ b/public/src/client/topic/posts.js
@@ -28,6 +28,8 @@ define('forum/topic/posts', [
});
updatePostCounts(data.posts);
+ ajaxify.data.postcount ++;
+ postTools.updatePostCount(ajaxify.data.postcount);
if (config.usePagination) {
onNewPostPagination(data);
@@ -220,7 +222,7 @@ define('forum/topic/posts', [
$this.wrap('<a href="' + $this.attr('src') + '" target="_blank">');
}
});
- postTools.updatePostCount();
+
addBlockquoteEllipses(posts.find('[component="post/content"] > blockquote > blockquote'));
hidePostToolsForDeletedPosts(posts);
Posts.showBottomPostBar();