mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-07 22:45:46 +01:00
moved increase/decrease
moved these two methods into addPostToTopic&removePostFromTopic
This commit is contained in:
@@ -108,12 +108,6 @@ module.exports = function (Topics) {
|
|||||||
function (next) {
|
function (next) {
|
||||||
updateCategory(postData, tid, next);
|
updateCategory(postData, tid, next);
|
||||||
},
|
},
|
||||||
function (next) {
|
|
||||||
Topics.decreasePostCount(postData.tid, next);
|
|
||||||
},
|
|
||||||
function (next) {
|
|
||||||
Topics.increasePostCount(tid, next);
|
|
||||||
},
|
|
||||||
function (next) {
|
function (next) {
|
||||||
posts.setPostField(pid, 'tid', tid, next);
|
posts.setPostField(pid, 'tid', tid, next);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -15,9 +15,6 @@ var utils = require('../../public/src/utils');
|
|||||||
module.exports = function (Topics) {
|
module.exports = function (Topics) {
|
||||||
Topics.onNewPostMade = function (postData, callback) {
|
Topics.onNewPostMade = function (postData, callback) {
|
||||||
async.series([
|
async.series([
|
||||||
function (next) {
|
|
||||||
Topics.increasePostCount(postData.tid, next);
|
|
||||||
},
|
|
||||||
function (next) {
|
function (next) {
|
||||||
Topics.updateLastPostTime(postData.tid, postData.timestamp, next);
|
Topics.updateLastPostTime(postData.tid, postData.timestamp, next);
|
||||||
},
|
},
|
||||||
@@ -287,6 +284,9 @@ module.exports = function (Topics) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
function (next) {
|
||||||
|
Topics.increasePostCount(tid, next);
|
||||||
|
},
|
||||||
function (next) {
|
function (next) {
|
||||||
db.sortedSetIncrBy('tid:' + tid + ':posters', 1, postData.uid, next);
|
db.sortedSetIncrBy('tid:' + tid + ':posters', 1, postData.uid, next);
|
||||||
},
|
},
|
||||||
@@ -304,6 +304,9 @@ module.exports = function (Topics) {
|
|||||||
'tid:' + tid + ':posts:votes',
|
'tid:' + tid + ':posts:votes',
|
||||||
], postData.pid, next);
|
], postData.pid, next);
|
||||||
},
|
},
|
||||||
|
function (next) {
|
||||||
|
Topics.decreasePostCount(tid, next);
|
||||||
|
},
|
||||||
function (next) {
|
function (next) {
|
||||||
db.sortedSetIncrBy('tid:' + tid + ':posters', -1, postData.uid, next);
|
db.sortedSetIncrBy('tid:' + tid + ':posters', -1, postData.uid, next);
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user