mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-13 01:15:47 +01:00
flat threadtools.purge
This commit is contained in:
@@ -73,31 +73,28 @@ var winston = require('winston'),
|
|||||||
}
|
}
|
||||||
|
|
||||||
ThreadTools.purge = function(tid, uid, callback) {
|
ThreadTools.purge = function(tid, uid, callback) {
|
||||||
ThreadTools.exists(tid, function(err, exists) {
|
async.waterfall([
|
||||||
if (err || !exists) {
|
function(next) {
|
||||||
return callback(err);
|
ThreadTools.exists(tid, next);
|
||||||
}
|
},
|
||||||
|
function(exists, next) {
|
||||||
batch.processSortedSet('tid:' + tid + ':posts', function(pids, next) {
|
if (!exists) {
|
||||||
async.eachLimit(pids, 10, posts.purge, next);
|
return callback();
|
||||||
}, {alwaysStartAt: 0}, function(err) {
|
|
||||||
if (err) {
|
|
||||||
return callback(err);
|
|
||||||
}
|
}
|
||||||
|
batch.processSortedSet('tid:' + tid + ':posts', function(pids, next) {
|
||||||
topics.getTopicField(tid, 'mainPid', function(err, mainPid) {
|
async.eachLimit(pids, 10, posts.purge, next);
|
||||||
if (err) {
|
}, {alwaysStartAt: 0}, next);
|
||||||
return callback(err);
|
},
|
||||||
}
|
function(next) {
|
||||||
posts.purge(mainPid, function(err) {
|
topics.getTopicField(tid, 'mainPid', next);
|
||||||
if (err) {
|
},
|
||||||
return callback(err);
|
function(mainPid, next) {
|
||||||
}
|
posts.purge(mainPid, next);
|
||||||
topics.purge(tid, callback);
|
},
|
||||||
});
|
function(next) {
|
||||||
});
|
topics.purge(tid, next);
|
||||||
});
|
}
|
||||||
});
|
], callback);
|
||||||
};
|
};
|
||||||
|
|
||||||
ThreadTools.lock = function(tid, uid, callback) {
|
ThreadTools.lock = function(tid, uid, callback) {
|
||||||
|
|||||||
Reference in New Issue
Block a user