v1.18.x
barisusakli 8 years ago
parent 7a0db03d99
commit 974106b7e2

@ -94,13 +94,17 @@ var plugins = require('./plugins');
}; };
Posts.getPostData = function (pid, callback) { Posts.getPostData = function (pid, callback) {
db.getObject('post:' + pid, function (err, data) { async.waterfall([
if (err) { function (next) {
return callback(err); db.getObject('post:' + pid, next);
},
function (data, next) {
plugins.fireHook('filter:post.getPostData', { post: data }, next);
},
function (data, next) {
next(null, data.post);
} }
], callback);
plugins.fireHook('filter:post.get', data, callback);
});
}; };
Posts.getPostField = function (pid, field, callback) { Posts.getPostField = function (pid, field, callback) {

@ -101,7 +101,7 @@ module.exports = function (Posts) {
if (err) { if (err) {
return next(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) { function (postData, next) {

Loading…
Cancel
Save