Răsfoiți Sursa

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 ani în urmă
părinte
comite
003a90c71c
1 a modificat fișierele cu 1 adăugiri și 6 ștergeri
  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;