moved increase/decrease

moved these two methods into addPostToTopic&removePostFromTopic
This commit is contained in:
Barış Soner Uşaklı
2018-10-11 18:10:49 -04:00
parent e615391b22
commit ba21c5170a
2 changed files with 6 additions and 9 deletions

View File

@@ -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);
},