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

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

@ -42,7 +42,7 @@ Categories.getNames = function(socket, data, callback) {
}; };
Categories.purge = function(socket, cid, callback) { Categories.purge = function(socket, cid, callback) {
categories.purge(cid, callback); categories.purge(cid, socket.uid, callback);
}; };
Categories.update = function(socket, data, 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; var mainPid;
async.waterfall([ async.waterfall([
function (next) { function (next) {
@ -94,11 +94,13 @@ module.exports = function(Topics) {
function (_mainPid, next) { function (_mainPid, next) {
mainPid = _mainPid; mainPid = _mainPid;
batch.processSortedSet('tid:' + tid + ':posts', function(pids, next) { 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); }, {alwaysStartAt: 0}, next);
}, },
function (next) { function (next) {
posts.purge(mainPid, next); posts.purge(mainPid, uid, next);
}, },
function (next) { function (next) {
Topics.purge(tid, next); Topics.purge(tid, next);

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

Loading…
Cancel
Save