Skip to content

Node.js based forum software built for the modern web

fire post edit after hook after post is saved

barisusakli6389bc762ca1
diff --git a/src/postTools.js b/src/postTools.js
index e308332abe..4b129a7e23 100644
--- a/src/postTools.js
+++ b/src/postTools.js
@@ -40,15 +40,14 @@ var winston = require('winston'),
return callback(err);
}
- posts.setPostFields(pid, {
- edited: Date.now(),
- editor: uid,
- content: postData.content
- });
-
- events.logPostEdit(uid, pid);
-
async.parallel({
+ post: function(next) {
+ posts.setPostFields(pid, {
+ edited: Date.now(),
+ editor: uid,
+ content: postData.content
+ }, next);
+ },
topic: function(next) {
var tid = postData.tid;
posts.isMain(pid, function(err, isMainPost) {
@@ -74,8 +73,6 @@ var winston = require('winston'),
topics.updateTags(tid, options.tags);
}
- plugins.fireHook('action:post.edit', postData);
-
next(null, {
tid: tid,
title: validator.escape(title),
@@ -87,7 +84,15 @@ var winston = require('winston'),
content: function(next) {
PostTools.parse(postData.content, next);
}
- }, callback);
+ }, function(err, results) {
+ if (err) {
+ return callback(err);
+ }
+
+ events.logPostEdit(uid, pid);
+ plugins.fireHook('action:post.edit', postData);
+ callback(null, results);
+ });
});
};