Skip to content

Node.js based forum software built for the modern web

closes #5610

barisusakli974106b7e2cd
diff --git a/src/posts.js b/src/posts.js
index 8949bae7f3..32b6a4454d 100644
--- a/src/posts.js
+++ b/src/posts.js
@@ -94,13 +94,17 @@ var plugins = require('./plugins');
};
Posts.getPostData = function (pid, callback) {
- db.getObject('post:' + pid, function (err, data) {
- if (err) {
- return callback(err);
+ async.waterfall([
+ function (next) {
+ db.getObject('post:' + pid, next);
+ },
+ function (data, next) {
+ plugins.fireHook('filter:post.getPostData', { post: data }, next);
+ },
+ function (data, next) {
+ next(null, data.post);
}
-
- plugins.fireHook('filter:post.get', data, callback);
- });
+ ], callback);
};
Posts.getPostField = function (pid, field, callback) {
diff --git a/src/posts/create.js b/src/posts/create.js
index 51fb89a97e..6ec02e6fc7 100644
--- a/src/posts/create.js
+++ b/src/posts/create.js
@@ -101,7 +101,7 @@ module.exports = function (Posts) {
if (err) {
return next(err);
}
- plugins.fireHook('filter:post.get', postData, next);
+ plugins.fireHook('filter:post.get', { post: postData, uid: data.uid }, next);
});
},
function (postData, next) {