Eliminate the use of MatrixClientPeg in utils (#10910)
This commit is contained in:
parent
a0c2676c38
commit
30429df948
108 changed files with 409 additions and 325 deletions
|
@ -75,9 +75,10 @@ export default class CreateRoomDialog extends React.Component<IProps, IState> {
|
|||
joinRule = JoinRule.Restricted;
|
||||
}
|
||||
|
||||
const cli = MatrixClientPeg.get();
|
||||
this.state = {
|
||||
isPublic: this.props.defaultPublic || false,
|
||||
isEncrypted: this.props.defaultEncrypted ?? privateShouldBeEncrypted(),
|
||||
isEncrypted: this.props.defaultEncrypted ?? privateShouldBeEncrypted(cli),
|
||||
joinRule,
|
||||
name: this.props.defaultName || "",
|
||||
topic: "",
|
||||
|
@ -88,9 +89,9 @@ export default class CreateRoomDialog extends React.Component<IProps, IState> {
|
|||
canChangeEncryption: true,
|
||||
};
|
||||
|
||||
MatrixClientPeg.get()
|
||||
.doesServerForceEncryptionForPreset(Preset.PrivateChat)
|
||||
.then((isForced) => this.setState({ canChangeEncryption: !isForced }));
|
||||
cli.doesServerForceEncryptionForPreset(Preset.PrivateChat).then((isForced) =>
|
||||
this.setState({ canChangeEncryption: !isForced }),
|
||||
);
|
||||
}
|
||||
|
||||
private roomCreateOptions(): IOpts {
|
||||
|
@ -284,7 +285,7 @@ export default class CreateRoomDialog extends React.Component<IProps, IState> {
|
|||
let e2eeSection: JSX.Element | undefined;
|
||||
if (this.state.joinRule !== JoinRule.Public) {
|
||||
let microcopy: string;
|
||||
if (privateShouldBeEncrypted()) {
|
||||
if (privateShouldBeEncrypted(MatrixClientPeg.get())) {
|
||||
if (this.state.canChangeEncryption) {
|
||||
microcopy = isVideoRoom
|
||||
? _t("You can't disable this later. The room will be encrypted but the embedded call will not.")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue