Fix phase enum usage in JS modules as well
https://github.com/matrix-org/matrix-react-sdk/pull/6185 converted `SetupEncryptionStore` to TS, including moving the phase states to an enum. The calling JS modules were forgotten, so they got a bit confused. Fixes https://github.com/vector-im/element-web/issues/17689 Regressed by https://github.com/matrix-org/matrix-react-sdk/pull/6185
This commit is contained in:
parent
2fd919e5c7
commit
538165d515
2 changed files with 12 additions and 27 deletions
|
@ -18,14 +18,7 @@ import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { _t } from '../../../languageHandler';
|
import { _t } from '../../../languageHandler';
|
||||||
import * as sdk from '../../../index';
|
import * as sdk from '../../../index';
|
||||||
import {
|
import { SetupEncryptionStore, Phase } from '../../../stores/SetupEncryptionStore';
|
||||||
SetupEncryptionStore,
|
|
||||||
PHASE_LOADING,
|
|
||||||
PHASE_INTRO,
|
|
||||||
PHASE_BUSY,
|
|
||||||
PHASE_DONE,
|
|
||||||
PHASE_CONFIRM_SKIP,
|
|
||||||
} from '../../../stores/SetupEncryptionStore';
|
|
||||||
import SetupEncryptionBody from "./SetupEncryptionBody";
|
import SetupEncryptionBody from "./SetupEncryptionBody";
|
||||||
import {replaceableComponent} from "../../../utils/replaceableComponent";
|
import {replaceableComponent} from "../../../utils/replaceableComponent";
|
||||||
|
|
||||||
|
@ -61,18 +54,18 @@ export default class CompleteSecurity extends React.Component {
|
||||||
let icon;
|
let icon;
|
||||||
let title;
|
let title;
|
||||||
|
|
||||||
if (phase === PHASE_LOADING) {
|
if (phase === Phase.Loading) {
|
||||||
return null;
|
return null;
|
||||||
} else if (phase === PHASE_INTRO) {
|
} else if (phase === Phase.Intro) {
|
||||||
icon = <span className="mx_CompleteSecurity_headerIcon mx_E2EIcon_warning" />;
|
icon = <span className="mx_CompleteSecurity_headerIcon mx_E2EIcon_warning" />;
|
||||||
title = _t("Verify this login");
|
title = _t("Verify this login");
|
||||||
} else if (phase === PHASE_DONE) {
|
} else if (phase === Phase.Done) {
|
||||||
icon = <span className="mx_CompleteSecurity_headerIcon mx_E2EIcon_verified" />;
|
icon = <span className="mx_CompleteSecurity_headerIcon mx_E2EIcon_verified" />;
|
||||||
title = _t("Session verified");
|
title = _t("Session verified");
|
||||||
} else if (phase === PHASE_CONFIRM_SKIP) {
|
} else if (phase === Phase.ConfirmSkip) {
|
||||||
icon = <span className="mx_CompleteSecurity_headerIcon mx_E2EIcon_warning" />;
|
icon = <span className="mx_CompleteSecurity_headerIcon mx_E2EIcon_warning" />;
|
||||||
title = _t("Are you sure?");
|
title = _t("Are you sure?");
|
||||||
} else if (phase === PHASE_BUSY) {
|
} else if (phase === Phase.Busy) {
|
||||||
icon = <span className="mx_CompleteSecurity_headerIcon mx_E2EIcon_warning" />;
|
icon = <span className="mx_CompleteSecurity_headerIcon mx_E2EIcon_warning" />;
|
||||||
title = _t("Verify this login");
|
title = _t("Verify this login");
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -21,15 +21,7 @@ import { MatrixClientPeg } from '../../../MatrixClientPeg';
|
||||||
import Modal from '../../../Modal';
|
import Modal from '../../../Modal';
|
||||||
import VerificationRequestDialog from '../../views/dialogs/VerificationRequestDialog';
|
import VerificationRequestDialog from '../../views/dialogs/VerificationRequestDialog';
|
||||||
import * as sdk from '../../../index';
|
import * as sdk from '../../../index';
|
||||||
import {
|
import { SetupEncryptionStore, Phase } from '../../../stores/SetupEncryptionStore';
|
||||||
SetupEncryptionStore,
|
|
||||||
PHASE_LOADING,
|
|
||||||
PHASE_INTRO,
|
|
||||||
PHASE_BUSY,
|
|
||||||
PHASE_DONE,
|
|
||||||
PHASE_CONFIRM_SKIP,
|
|
||||||
PHASE_FINISHED,
|
|
||||||
} from '../../../stores/SetupEncryptionStore';
|
|
||||||
import {replaceableComponent} from "../../../utils/replaceableComponent";
|
import {replaceableComponent} from "../../../utils/replaceableComponent";
|
||||||
|
|
||||||
function keyHasPassphrase(keyInfo) {
|
function keyHasPassphrase(keyInfo) {
|
||||||
|
@ -63,7 +55,7 @@ export default class SetupEncryptionBody extends React.Component {
|
||||||
|
|
||||||
_onStoreUpdate = () => {
|
_onStoreUpdate = () => {
|
||||||
const store = SetupEncryptionStore.sharedInstance();
|
const store = SetupEncryptionStore.sharedInstance();
|
||||||
if (store.phase === PHASE_FINISHED) {
|
if (store.phase === Phase.Finished) {
|
||||||
this.props.onFinished();
|
this.props.onFinished();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -136,7 +128,7 @@ export default class SetupEncryptionBody extends React.Component {
|
||||||
onClose={this.props.onFinished}
|
onClose={this.props.onFinished}
|
||||||
member={MatrixClientPeg.get().getUser(this.state.verificationRequest.otherUserId)}
|
member={MatrixClientPeg.get().getUser(this.state.verificationRequest.otherUserId)}
|
||||||
/>;
|
/>;
|
||||||
} else if (phase === PHASE_INTRO) {
|
} else if (phase === Phase.Intro) {
|
||||||
const store = SetupEncryptionStore.sharedInstance();
|
const store = SetupEncryptionStore.sharedInstance();
|
||||||
let recoveryKeyPrompt;
|
let recoveryKeyPrompt;
|
||||||
if (store.keyInfo && keyHasPassphrase(store.keyInfo)) {
|
if (store.keyInfo && keyHasPassphrase(store.keyInfo)) {
|
||||||
|
@ -174,7 +166,7 @@ export default class SetupEncryptionBody extends React.Component {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
} else if (phase === PHASE_DONE) {
|
} else if (phase === Phase.Done) {
|
||||||
let message;
|
let message;
|
||||||
if (this.state.backupInfo) {
|
if (this.state.backupInfo) {
|
||||||
message = <p>{_t(
|
message = <p>{_t(
|
||||||
|
@ -200,7 +192,7 @@ export default class SetupEncryptionBody extends React.Component {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
} else if (phase === PHASE_CONFIRM_SKIP) {
|
} else if (phase === Phase.ConfirmSkip) {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<p>{_t(
|
<p>{_t(
|
||||||
|
@ -224,7 +216,7 @@ export default class SetupEncryptionBody extends React.Component {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
} else if (phase === PHASE_BUSY || phase === PHASE_LOADING) {
|
} else if (phase === Phase.Busy || phase === Phase.Loading) {
|
||||||
const Spinner = sdk.getComponent('views.elements.Spinner');
|
const Spinner = sdk.getComponent('views.elements.Spinner');
|
||||||
return <Spinner />;
|
return <Spinner />;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue