Fix slash commands not being enabled in certain cases (#11090)

* Fix slash commands not being enabled in certain cases

* Fix import cycle
This commit is contained in:
Michael Telatynski 2023-06-14 13:49:18 +01:00 committed by GitHub
parent 9c48487d85
commit 6486255f54
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 10 deletions

View file

@ -19,6 +19,7 @@ import React from "react";
import { _t } from "../../../languageHandler";
import { Command, CommandCategories, Commands } from "../../../SlashCommands";
import InfoDialog from "./InfoDialog";
import { MatrixClientPeg } from "../../../MatrixClientPeg";
interface IProps {
onFinished(): void;
@ -27,7 +28,7 @@ interface IProps {
const SlashCommandHelpDialog: React.FC<IProps> = ({ onFinished }) => {
const categories: Record<string, Command[]> = {};
Commands.forEach((cmd) => {
if (!cmd.isEnabled()) return;
if (!cmd.isEnabled(MatrixClientPeg.get())) return;
if (!categories[cmd.category]) {
categories[cmd.category] = [];
}