moved increase/decrease

moved these two methods into addPostToTopic&removePostFromTopic
v1.18.x
Barış Soner Uşaklı 6 years ago
parent e615391b22
commit ba21c5170a

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

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

Loading…
Cancel
Save