Skip to content

Node.js based forum software built for the modern web

feat: added new filter hook filter:post.getRawPost

Julian Lam973075cfbc21
diff --git a/src/socket.io/posts.js b/src/socket.io/posts.js
index 19833df6b7..ea1bffb06a 100644
--- a/src/socket.io/posts.js
+++ b/src/socket.io/posts.js
@@ -85,9 +85,20 @@ SocketPosts.getRawPost = function (socket, pid, callback) {
if (postData.deleted) {
return next(new Error('[[error:no-post]]'));
}
- next(null, postData.content);
+ next(null, postData);
},
- ], callback);
+ function (postData, next) {
+ plugins.fireHook('filter:post.getRawPost', Object.assign(postData, {
+ pid: pid,
+ }), next);
+ },
+ ], function (err, postData) {
+ if (err) {
+ return callback(err);
+ }
+
+ callback(null, postData.content);
+ });
};
SocketPosts.getTimestampByIndex = function (socket, data, callback) {