Skip to content

Commit

Permalink
chore: found some hooks that don't play well docgen
Browse files Browse the repository at this point in the history
  • Loading branch information
psychobunny committed Aug 31, 2021
1 parent 3df7968 commit ae793b4
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion public/src/client/topic/postTools.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions src/groups/invite.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
Expand Down
3 changes: 2 additions & 1 deletion src/plugins/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
};

Expand Down
3 changes: 2 additions & 1 deletion src/topics/tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]]');
Expand Down

0 comments on commit ae793b4

Please sign in to comment.