Skip to content

Node.js based forum software built for the modern web

moved increase/decrease

Barış Soner Uşaklıba21c5170a37
diff --git a/src/topics/fork.js b/src/topics/fork.js
index e1e3b51339..4ac4dfb113 100644
--- a/src/topics/fork.js
+++ b/src/topics/fork.js
@@ -108,12 +108,6 @@ module.exports = function (Topics) {
function (next) {
updateCategory(postData, tid, next);
},
- function (next) {
- Topics.decreasePostCount(postData.tid, next);
- },
- function (next) {
- Topics.increasePostCount(tid, next);
- },
function (next) {
posts.setPostField(pid, 'tid', tid, next);
},
diff --git a/src/topics/posts.js b/src/topics/posts.js
index eb31fc0171..7e1140e5fa 100644
--- a/src/topics/posts.js
+++ b/src/topics/posts.js
@@ -15,9 +15,6 @@ var utils = require('../../public/src/utils');
module.exports = function (Topics) {
Topics.onNewPostMade = function (postData, callback) {
async.series([
- function (next) {
- Topics.increasePostCount(postData.tid, next);
- },
function (next) {
Topics.updateLastPostTime(postData.tid, postData.timestamp, next);
},
@@ -287,6 +284,9 @@ module.exports = function (Topics) {
});
}
},
+ function (next) {
+ Topics.increasePostCount(tid, next);
+ },
function (next) {
db.sortedSetIncrBy('tid:' + tid + ':posters', 1, postData.uid, next);
},
@@ -304,6 +304,9 @@ module.exports = function (Topics) {
'tid:' + tid + ':posts:votes',
], postData.pid, next);
},
+ function (next) {
+ Topics.decreasePostCount(tid, next);
+ },
function (next) {
db.sortedSetIncrBy('tid:' + tid + ':posters', -1, postData.uid, next);
},