Node.js based forum software built for the modern web
fixing topic deletion and purging
Julian Lamf9f1cf63cf9f
diff --git a/src/posts/delete.js b/src/posts/delete.jsindex 40e827c574..05ad297d1c 100644--- a/src/posts/delete.js+++ b/src/posts/delete.js@@ -128,7 +128,7 @@ module.exports = function(Posts) {return callback(err);}- plugins.fireHook('action:post.delete', pid);+ plugins.fireHook('action:post.purge', pid);db.delete('post:' + pid, callback);});});diff --git a/src/threadTools.js b/src/threadTools.jsindex bb0ef3cd80..4802e9510d 100644--- a/src/threadTools.js+++ b/src/threadTools.js@@ -53,7 +53,7 @@ var winston = require('winston'),return callback(err);}- ThreadTools[isDelete ? 'lock' : 'unlock'](tid);+ ThreadTools[isDelete ? 'lock' : 'unlock'](tid, uid);if (isDelete) {plugins.fireHook('action:topic.delete', tid);} else {@@ -119,7 +119,7 @@ var winston = require('winston'),});}- if (err) {+ if (err && typeof callback === 'function') {return callback(err);}@@ -134,10 +134,12 @@ var winston = require('winston'),emitTo('topic_' + tid);emitTo('category_' + cid);- callback(null, {- tid: tid,- isLocked: lock- });+ if (typeof callback === 'function') {+ callback(null, {+ tid: tid,+ isLocked: lock+ });+ }});}diff --git a/src/topics/delete.js b/src/topics/delete.jsindex 630e4eddc7..bb3aa3af50 100644--- a/src/topics/delete.js+++ b/src/topics/delete.js@@ -66,7 +66,7 @@ module.exports = function(Topics) {if (err) {return callback(err);}- plugins.fireHook('action:topic.delete', tid);+ plugins.fireHook('action:topic.purge', tid);db.delete('topic:' + tid, callback);});};