diff --git a/src/posts/create.js b/src/posts/create.js index 4589e6ae9f..041d662915 100644 --- a/src/posts/create.js +++ b/src/posts/create.js @@ -1,6 +1,7 @@ 'use strict'; var async = require('async'), + _ = require('underscore'), meta = require('../meta'), db = require('../database'), @@ -91,7 +92,7 @@ module.exports = function(Posts) { }); }, function(postData, next) { - plugins.fireHook('action:post.save', postData); + plugins.fireHook('action:post.save', _.clone(postData)); next(null, postData); } ], callback); diff --git a/src/posts/delete.js b/src/posts/delete.js index 733ed1006b..44d969b8ab 100644 --- a/src/posts/delete.js +++ b/src/posts/delete.js @@ -1,6 +1,8 @@ 'use strict'; var async = require('async'), + _ = require('underscore'), + db = require('../database'), topics = require('../topics'), user = require('../user'), @@ -59,7 +61,7 @@ module.exports = function(Posts) { }, function(cid, next) { postData.cid = cid; - plugins.fireHook('action:post.restore', postData); + plugins.fireHook('action:post.restore', _.clone(postData)); async.parallel([ function(next) { diff --git a/src/topics/delete.js b/src/topics/delete.js index e194d9cd23..b7bb2ea71e 100644 --- a/src/topics/delete.js +++ b/src/topics/delete.js @@ -32,7 +32,9 @@ module.exports = function(Topics) { db.sortedSetRemove('cid:' + topicData.cid + ':pids', pids, next); }); } - ], callback); + ], function(err, results) { + callback(err); + }); }); }; @@ -77,7 +79,9 @@ module.exports = function(Topics) { }); }); } - ], callback); + ], function(err, results) { + callback(err); + }); }); }; diff --git a/src/topics/tools.js b/src/topics/tools.js index 16ab1c5ecc..00b15c5994 100644 --- a/src/topics/tools.js +++ b/src/topics/tools.js @@ -61,7 +61,7 @@ module.exports = function(Topics) { uid: uid }; - callback(null, data); + next(null, data); } ], callback); }