From be82bdfdf30d116a892bd145ffcd7ad120aa0b21 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Wed, 15 Apr 2026 16:05:09 +0100 Subject: [PATCH] InviteDialog: factor out startDmOrSendInvites Factor out the logic of calling `startDm` or `inviteUsers` to a helper function. We're going to need to call this from a second location soon, so this is useful groundwork. --- .../components/views/dialogs/InviteDialog.tsx | 25 +++++++++++++++---- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/apps/web/src/components/views/dialogs/InviteDialog.tsx b/apps/web/src/components/views/dialogs/InviteDialog.tsx index be208b24a2..9817a12403 100644 --- a/apps/web/src/components/views/dialogs/InviteDialog.tsx +++ b/apps/web/src/components/views/dialogs/InviteDialog.tsx @@ -444,6 +444,21 @@ export default class InviteDialog extends React.PureComponent { + if (this.props.kind === InviteKind.Dm) { + await this.startDm(); + } else if (this.props.kind === InviteKind.Invite) { + await this.inviteUsers(); + } else { + throw new Error("Unknown InviteKind: " + this.props.kind); + } + } + private transferCall = async (): Promise => { if (this.props.kind !== InviteKind.CallTransfer) return; if (this.state.currentTabId == TabId.UserDirectory) { @@ -1129,8 +1144,6 @@ export default class InviteDialog extends React.PureComponent Promise) | null = null; - const identityServersEnabled = SettingsStore.getValue(UIFeature.IdentityServer); const cli = MatrixClientPeg.safeGet(); @@ -1167,7 +1180,6 @@ export default class InviteDialog extends React.PureComponent { + this.startDmOrSendInvites().catch((e) => logErrorAndShowErrorDialog("Error processing invites", e)); + }; + return (

{helpText}

@@ -1223,7 +1238,7 @@ export default class InviteDialog extends React.PureComponent