From 1e137636c9321524fa2c7a5bc5bb32def9c023f0 Mon Sep 17 00:00:00 2001 From: barisusakli Date: Thu, 12 Jan 2017 14:31:28 +0300 Subject: [PATCH] closes #5359 --- src/topics/delete.js | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/topics/delete.js b/src/topics/delete.js index 91c1bf53e3..d7148f55c3 100644 --- a/src/topics/delete.js +++ b/src/topics/delete.js @@ -137,15 +137,18 @@ module.exports = function (Topics) { function (next) { reduceCounters(tid, next); } - ], next); - } - ], function (err) { - if (err) { - return callback(err); + ], function (err) { + next(err); + }); + }, + function (next) { + Topics.getTopicData(tid, next); + }, + function (topicData, next) { + plugins.fireHook('action:topic.purge', {topic: topicData, uid: uid}); + db.delete('topic:' + tid, next); } - plugins.fireHook('action:topic.purge', tid); - db.delete('topic:' + tid, callback); - }); + ], callback); }; function deleteFromFollowersIgnorers(tid, callback) {