mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-03-13 08:00:43 +01:00
refactor: move plugin hook methods to plugin.hooks.*
This commit is contained in:
@@ -40,7 +40,7 @@ module.exports = function (Posts) {
|
||||
editPostData.handle = data.handle;
|
||||
}
|
||||
|
||||
const result = await plugins.fireHook('filter:post.edit', {
|
||||
const result = await plugins.hooks.fire('filter:post.edit', {
|
||||
req: data.req,
|
||||
post: editPostData,
|
||||
data: data,
|
||||
@@ -79,7 +79,7 @@ module.exports = function (Posts) {
|
||||
nid: 'edit_post:' + data.pid + ':uid:' + data.uid,
|
||||
});
|
||||
|
||||
plugins.fireHook('action:post.edit', { post: _.clone(returnPostData), data: data, uid: data.uid });
|
||||
plugins.hooks.fire('action:post.edit', { post: _.clone(returnPostData), data: data, uid: data.uid });
|
||||
|
||||
require('./cache').del(String(postData.pid));
|
||||
pubsub.publish('post:edit', String(postData.pid));
|
||||
@@ -134,7 +134,7 @@ module.exports = function (Posts) {
|
||||
}
|
||||
await topics.validateTags(data.tags, topicData.cid);
|
||||
|
||||
const results = await plugins.fireHook('filter:topic.edit', {
|
||||
const results = await plugins.hooks.fire('filter:topic.edit', {
|
||||
req: data.req,
|
||||
topic: newTopicData,
|
||||
data: data,
|
||||
@@ -147,7 +147,7 @@ module.exports = function (Posts) {
|
||||
newTopicData.oldTitle = topicData.title;
|
||||
newTopicData.timestamp = topicData.timestamp;
|
||||
const renamed = translator.escape(validator.escape(String(title))) !== topicData.title;
|
||||
plugins.fireHook('action:topic.edit', { topic: newTopicData, uid: data.uid });
|
||||
plugins.hooks.fire('action:topic.edit', { topic: newTopicData, uid: data.uid });
|
||||
return {
|
||||
tid: tid,
|
||||
cid: newTopicData.cid,
|
||||
|
||||
Reference in New Issue
Block a user