v1.18.x
barisusakli 9 years ago
parent 3567f2ad55
commit ebcd892aee

@ -8,10 +8,10 @@ var async = require('async'),
module.exports = function(Categories) {
Categories.purge = function(cid, callback) {
Categories.purge = function(cid, uid, callback) {
batch.processSortedSet('cid:' + cid + ':tids', function(tids, next) {
async.eachLimit(tids, 10, function(tid, next) {
topics.purgePostsAndTopic(tid, next);
topics.purgePostsAndTopic(tid, uid, next);
}, next);
}, {alwaysStartAt: 0}, function(err) {
if (err) {

@ -42,7 +42,7 @@ Categories.getNames = function(socket, data, callback) {
};
Categories.purge = function(socket, cid, callback) {
categories.purge(cid, callback);
categories.purge(cid, socket.uid, callback);
};
Categories.update = function(socket, data, callback) {

@ -85,7 +85,7 @@ module.exports = function(Topics) {
});
};
Topics.purgePostsAndTopic = function(tid, callback) {
Topics.purgePostsAndTopic = function(tid, uid, callback) {
var mainPid;
async.waterfall([
function (next) {
@ -94,11 +94,13 @@ module.exports = function(Topics) {
function (_mainPid, next) {
mainPid = _mainPid;
batch.processSortedSet('tid:' + tid + ':posts', function(pids, next) {
async.eachLimit(pids, 10, posts.purge, next);
async.eachLimit(pids, 10, function(pid, next) {
posts.purge(pid, uid, next);
}, next);
}, {alwaysStartAt: 0}, next);
},
function (next) {
posts.purge(mainPid, next);
posts.purge(mainPid, uid, next);
},
function (next) {
Topics.purge(tid, next);

@ -94,7 +94,7 @@ module.exports = function(Topics) {
function (_cid, next) {
cid = _cid;
Topics.purgePostsAndTopic(tid, next);
Topics.purgePostsAndTopic(tid, uid, next);
},
function (next) {
next(null, {tid: tid, cid: cid, uid: uid});

Loading…
Cancel
Save