浏览代码

Don't explicitly trigger the hook `parseMessageForCommands`

inside `parseMessageForMUCCommands`.

If the function doesn't find any core MUC commands, it calls
`parseMessageForCommands` which will trigger the hook.

I think it's appropriate to give built-in commands preference above
commands by 3rd party plugins and this also solves the issue of the hook
being triggered twice (once in `parseMessageForMUCCommands` and
then again in `parseMessageForCommands`).
JC Brand 3 年之前
父节点
当前提交
003a90c71c
共有 1 个文件被更改,包括 1 次插入6 次删除
  1. 1 6
      src/plugins/muc-views/utils.js

+ 1 - 6
src/plugins/muc-views/utils.js

@@ -298,7 +298,7 @@ export function showOccupantModal (ev, occupant) {
 }
 
 
-export async function parseMessageForMUCCommands (muc, text) {
+export function parseMessageForMUCCommands (muc, text) {
     if (
         api.settings.get('muc_disable_slash_commands') &&
         !Array.isArray(api.settings.get('muc_disable_slash_commands'))
@@ -311,11 +311,6 @@ export async function parseMessageForMUCCommands (muc, text) {
         return false;
     }
 
-    const handled = await api.hook('parseMessageForCommands', {model: muc, text}, false);
-    if (handled) {
-        return true;
-    }
-
     const args = text.slice(('/' + command).length + 1).trim();
     if (!muc.getAllowedCommands().includes(command)) {
         return false;