fixing topic deletion and purging

v1.18.x
Julian Lam 10 years ago
parent 5281c8c376
commit f9f1cf63cf

@ -128,7 +128,7 @@ module.exports = function(Posts) {
return callback(err); return callback(err);
} }
plugins.fireHook('action:post.delete', pid); plugins.fireHook('action:post.purge', pid);
db.delete('post:' + pid, callback); db.delete('post:' + pid, callback);
}); });
}); });

@ -53,7 +53,7 @@ var winston = require('winston'),
return callback(err); return callback(err);
} }
ThreadTools[isDelete ? 'lock' : 'unlock'](tid); ThreadTools[isDelete ? 'lock' : 'unlock'](tid, uid);
if (isDelete) { if (isDelete) {
plugins.fireHook('action:topic.delete', tid); plugins.fireHook('action:topic.delete', tid);
} else { } else {
@ -119,7 +119,7 @@ var winston = require('winston'),
}); });
} }
if (err) { if (err && typeof callback === 'function') {
return callback(err); return callback(err);
} }
@ -134,10 +134,12 @@ var winston = require('winston'),
emitTo('topic_' + tid); emitTo('topic_' + tid);
emitTo('category_' + cid); emitTo('category_' + cid);
if (typeof callback === 'function') {
callback(null, { callback(null, {
tid: tid, tid: tid,
isLocked: lock isLocked: lock
}); });
}
}); });
} }

@ -66,7 +66,7 @@ module.exports = function(Topics) {
if (err) { if (err) {
return callback(err); return callback(err);
} }
plugins.fireHook('action:topic.delete', tid); plugins.fireHook('action:topic.purge', tid);
db.delete('topic:' + tid, callback); db.delete('topic:' + tid, callback);
}); });
}; };

Loading…
Cancel
Save