mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-08 23:15:48 +01:00
This commit is contained in:
@@ -13,7 +13,8 @@ var winston = require('winston'),
|
||||
meta = require('./meta'),
|
||||
websockets = require('./socket.io'),
|
||||
events = require('./events'),
|
||||
plugins = require('./plugins');
|
||||
plugins = require('./plugins'),
|
||||
batch = require('./batch');
|
||||
|
||||
|
||||
(function(ThreadTools) {
|
||||
@@ -71,26 +72,24 @@ var winston = require('winston'),
|
||||
}
|
||||
|
||||
ThreadTools.purge = function(tid, uid, callback) {
|
||||
async.parallel({
|
||||
topic: function(next) {
|
||||
topics.getTopicFields(tid, ['cid'], next);
|
||||
},
|
||||
pids: function(next) {
|
||||
topics.getPids(tid, next);
|
||||
}
|
||||
}, function(err, results) {
|
||||
batch.processSortedSet('tid:' + tid + ':posts', function(err, pids, next) {
|
||||
async.eachLimit(pids, 10, posts.purge, next);
|
||||
}, {alwaysStartAt: 0}, function(err) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
|
||||
async.parallel([
|
||||
function(next) {
|
||||
async.eachLimit(results.pids, 10, posts.purge, next);
|
||||
},
|
||||
function(next) {
|
||||
topics.purge(tid, next);
|
||||
topics.getTopicField(tid, 'mainPid', function(err, mainPid) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
], callback);
|
||||
posts.purge(mainPid, function(err) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
topics.purge(tid, callback);
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user