Add customisation point for visibility of invites and room creation

Fixes https://github.com/vector-im/element-web/issues/19331
This commit is contained in:
Travis Ralston 2021-10-08 16:04:26 -06:00
parent 3417c03f41
commit d99660d420
11 changed files with 146 additions and 43 deletions

View file

@ -44,7 +44,7 @@ import { Action } from "./dispatcher/actions";
import { EffectiveMembership, getEffectiveMembership, leaveRoomBehaviour } from "./utils/membership";
import SdkConfig from "./SdkConfig";
import SettingsStore from "./settings/SettingsStore";
import { UIFeature } from "./settings/UIFeature";
import { UIComponent, UIFeature } from "./settings/UIFeature";
import { CHAT_EFFECTS } from "./effects";
import CallHandler from "./CallHandler";
import { guessAndSetDMRoom } from "./Rooms";
@ -56,6 +56,7 @@ import InfoDialog from "./components/views/dialogs/InfoDialog";
import SlashCommandHelpDialog from "./components/views/dialogs/SlashCommandHelpDialog";
import { logger } from "matrix-js-sdk/src/logger";
import { shouldShowComponent } from "./customisations/helpers/UIComponents";
// XXX: workaround for https://github.com/microsoft/TypeScript/issues/31816
interface HTMLInputEvent extends Event {
@ -403,6 +404,7 @@ export const Commands = [
command: 'invite',
args: '<user-id> [<reason>]',
description: _td('Invites user with given id to current room'),
isEnabled: () => shouldShowComponent(UIComponent.InviteUsers),
runFn: function(roomId, args) {
if (args) {
const [address, reason] = args.split(/\s+(.+)/);