Skip to content

Node.js based forum software built for the modern web

chore: found some hooks that don't play well docgen

psychobunnyae793b4a44f5
diff --git a/public/src/client/topic/postTools.js b/public/src/client/topic/postTools.js
index 0323663f81..dfc9f6ce72 100644
--- a/public/src/client/topic/postTools.js
+++ b/public/src/client/topic/postTools.js
@@ -353,7 +353,7 @@ define('forum/topic/postTools', [
return app.alertError(err);
}
var type = method === 'put' ? 'bookmark' : 'unbookmark';
- hooks.fire('action:post.' + type, { pid: pid });
+ hooks.fire(`action:post.${type}`, { pid: pid });
});
return false;
}
diff --git a/src/groups/invite.js b/src/groups/invite.js
index b08d6c0bcf..784f0f560b 100644
--- a/src/groups/invite.js
+++ b/src/groups/invite.js
@@ -82,8 +82,8 @@ module.exports = function (Groups) {
const set = type === 'invite' ? `group:${groupName}:invited` : `group:${groupName}:pending`;
await db.setAdd(set, uids);
- const hookName = type === 'invite' ? 'action:group.inviteMember' : 'action:group.requestMembership';
- plugins.hooks.fire(hookName, {
+ const hookName = type === 'invite' ? 'inviteMember' : 'requestMembership';
+ plugins.hooks.fire(`action:group.${hookName}`, {
groupName: groupName,
uids: uids,
});
diff --git a/src/plugins/install.js b/src/plugins/install.js
index b6a7726b9e..4b3111d56c 100644
--- a/src/plugins/install.js
+++ b/src/plugins/install.js
@@ -65,7 +65,8 @@ module.exports = function (Plugins) {
await db.sortedSetAdd('plugins:active', count, id);
}
meta.reloadRequired = true;
- Plugins.hooks.fire(isActive ? 'action:plugin.deactivate' : 'action:plugin.activate', { id: id });
+ const hook = isActive ? 'deactivate' : 'activate';
+ Plugins.hooks.fire(`action:plugin.${isActive}`, { id: id });
return { id: id, active: !isActive };
};
diff --git a/src/topics/tools.js b/src/topics/tools.js
index 1fe032fe13..e296b2d333 100644
--- a/src/topics/tools.js
+++ b/src/topics/tools.js
@@ -33,7 +33,8 @@ module.exports = function (Topics) {
}
const canDelete = await privileges.topics.canDelete(tid, uid);
- const data = await plugins.hooks.fire(isDelete ? 'filter:topic.delete' : 'filter:topic.restore', { topicData: topicData, uid: uid, isDelete: isDelete, canDelete: canDelete, canRestore: canDelete });
+ const hook = isDelete ? 'delete' : 'restore';
+ const data = await plugins.hooks.fire(`filter:topic.${hook}`, { topicData: topicData, uid: uid, isDelete: isDelete, canDelete: canDelete, canRestore: canDelete });
if ((!data.canDelete && data.isDelete) || (!data.canRestore && !data.isDelete)) {
throw new Error('[[error:no-privileges]]');