refactor: move plugin hook methods to plugin.hooks.*

This commit is contained in:
Julian Lam
2020-11-20 16:06:26 -05:00
parent 3b1c03ed50
commit 6e2da9966e
136 changed files with 550 additions and 541 deletions

View File

@@ -47,7 +47,7 @@ module.exports = function (Posts) {
postData.handle = data.handle;
}
let result = await plugins.fireHook('filter:post.create', { post: postData, data: data });
let result = await plugins.hooks.fire('filter:post.create', { post: postData, data: data });
postData = result.post;
await db.setObject('post:' + postData.pid, postData);
@@ -65,9 +65,9 @@ module.exports = function (Posts) {
Posts.uploads.sync(postData.pid),
]);
result = await plugins.fireHook('filter:post.get', { post: postData, uid: data.uid });
result = await plugins.hooks.fire('filter:post.get', { post: postData, uid: data.uid });
result.post.isMain = isMain;
plugins.fireHook('action:post.save', { post: _.clone(result.post) });
plugins.hooks.fire('action:post.save', { post: _.clone(result.post) });
return result.post;
};