Simplifications in InviteDialog (#33156)

* InviteDialog: simplify users section for CallTransferDialog

The majority of `renderMainTab` is enpty for the call transfer dialog, so we
may as well inkine the bits that aren't.

* Simplify `renderMainTab`

Now that this is unused for CallTransfer, we can simplify

* Remove redundant eslint-disable

eslint seems happy without this, and we shouldn't be disabling lints for a
whole file anyway
This commit is contained in:
Richard van der Hoff
2026-04-16 10:03:26 +01:00
committed by GitHub
parent d4aea25600
commit 583eae63f7
@@ -65,9 +65,6 @@ import { type UserProfilesStore } from "../../../stores/UserProfilesStore";
import InviteProgressBody from "./InviteProgressBody.tsx"; import InviteProgressBody from "./InviteProgressBody.tsx";
import MultiInviter, { type CompletionStates as MultiInviterCompletionStates } from "../../../utils/MultiInviter.ts"; import MultiInviter, { type CompletionStates as MultiInviterCompletionStates } from "../../../utils/MultiInviter.ts";
// we have a number of types defined from the Matrix spec which can't reasonably be altered here.
/* eslint-disable camelcase */
interface Result { interface Result {
userId: string; userId: string;
user: Member; user: Member;
@@ -1186,8 +1183,7 @@ export default class InviteDialog extends React.PureComponent<Props, IInviteDial
} }
/** /**
* Render content of the common "users" tab that is shown whether we have a regular invite dialog or a * Render content of the "users" that is used for both invites and "start chat".
* "CallTransfer" one.
*/ */
private renderMainTab(): JSX.Element { private renderMainTab(): JSX.Element {
let helpText; let helpText;
@@ -1275,10 +1271,15 @@ export default class InviteDialog extends React.PureComponent<Props, IInviteDial
buttonText = _t("action|invite"); buttonText = _t("action|invite");
goButtonFn = this.inviteUsers; goButtonFn = this.inviteUsers;
} else {
throw new Error("Unknown InviteDialog kind: " + this.props.kind);
} }
const goButton = return (
this.props.kind == InviteKind.CallTransfer ? null : ( <React.Fragment>
<p className="mx_InviteDialog_helpText">{helpText}</p>
<div className="mx_InviteDialog_addressBar">
{this.renderEditor()}
<AccessibleButton <AccessibleButton
kind="primary" kind="primary"
onClick={goButtonFn} onClick={goButtonFn}
@@ -1287,14 +1288,6 @@ export default class InviteDialog extends React.PureComponent<Props, IInviteDial
> >
{buttonText} {buttonText}
</AccessibleButton> </AccessibleButton>
);
return (
<React.Fragment>
<p className="mx_InviteDialog_helpText">{helpText}</p>
<div className="mx_InviteDialog_addressBar">
{this.renderEditor()}
{goButton}
</div> </div>
{this.state.busy ? <InviteProgressBody /> : this.renderSuggestions()} {this.state.busy ? <InviteProgressBody /> : this.renderSuggestions()}
</React.Fragment> </React.Fragment>
@@ -1342,7 +1335,12 @@ export default class InviteDialog extends React.PureComponent<Props, IInviteDial
* See also: {@link renderRegularDialog}. * See also: {@link renderRegularDialog}.
*/ */
private renderCallTransferDialog(): React.ReactNode { private renderCallTransferDialog(): React.ReactNode {
const usersSection = this.renderMainTab(); const usersSection = (
<React.Fragment>
<div className="mx_InviteDialog_addressBar">{this.renderEditor()}</div>
{this.state.busy ? <InviteProgressBody /> : this.renderSuggestions()}
</React.Fragment>
);
const tabs: NonEmptyArray<Tab<TabId>> = [ const tabs: NonEmptyArray<Tab<TabId>> = [
new Tab( new Tab(