Skip to content

Commit f34086a

Browse files
authored
Merge pull request matrix-org#6214 from matrix-org/jryans/enc-phase-ts
Fix phase enum usage in JS modules as well
2 parents 2fd919e + 538165d commit f34086a

File tree

2 files changed

+12
-27
lines changed

2 files changed

+12
-27
lines changed

src/components/structures/auth/CompleteSecurity.js

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,7 @@ import React from 'react';
1818
import PropTypes from 'prop-types';
1919
import { _t } from '../../../languageHandler';
2020
import * as sdk from '../../../index';
21-
import {
22-
SetupEncryptionStore,
23-
PHASE_LOADING,
24-
PHASE_INTRO,
25-
PHASE_BUSY,
26-
PHASE_DONE,
27-
PHASE_CONFIRM_SKIP,
28-
} from '../../../stores/SetupEncryptionStore';
21+
import { SetupEncryptionStore, Phase } from '../../../stores/SetupEncryptionStore';
2922
import SetupEncryptionBody from "./SetupEncryptionBody";
3023
import {replaceableComponent} from "../../../utils/replaceableComponent";
3124

@@ -61,18 +54,18 @@ export default class CompleteSecurity extends React.Component {
6154
let icon;
6255
let title;
6356

64-
if (phase === PHASE_LOADING) {
57+
if (phase === Phase.Loading) {
6558
return null;
66-
} else if (phase === PHASE_INTRO) {
59+
} else if (phase === Phase.Intro) {
6760
icon = <span className="mx_CompleteSecurity_headerIcon mx_E2EIcon_warning" />;
6861
title = _t("Verify this login");
69-
} else if (phase === PHASE_DONE) {
62+
} else if (phase === Phase.Done) {
7063
icon = <span className="mx_CompleteSecurity_headerIcon mx_E2EIcon_verified" />;
7164
title = _t("Session verified");
72-
} else if (phase === PHASE_CONFIRM_SKIP) {
65+
} else if (phase === Phase.ConfirmSkip) {
7366
icon = <span className="mx_CompleteSecurity_headerIcon mx_E2EIcon_warning" />;
7467
title = _t("Are you sure?");
75-
} else if (phase === PHASE_BUSY) {
68+
} else if (phase === Phase.Busy) {
7669
icon = <span className="mx_CompleteSecurity_headerIcon mx_E2EIcon_warning" />;
7770
title = _t("Verify this login");
7871
} else {

src/components/structures/auth/SetupEncryptionBody.js

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,7 @@ import { MatrixClientPeg } from '../../../MatrixClientPeg';
2121
import Modal from '../../../Modal';
2222
import VerificationRequestDialog from '../../views/dialogs/VerificationRequestDialog';
2323
import * as sdk from '../../../index';
24-
import {
25-
SetupEncryptionStore,
26-
PHASE_LOADING,
27-
PHASE_INTRO,
28-
PHASE_BUSY,
29-
PHASE_DONE,
30-
PHASE_CONFIRM_SKIP,
31-
PHASE_FINISHED,
32-
} from '../../../stores/SetupEncryptionStore';
24+
import { SetupEncryptionStore, Phase } from '../../../stores/SetupEncryptionStore';
3325
import {replaceableComponent} from "../../../utils/replaceableComponent";
3426

3527
function keyHasPassphrase(keyInfo) {
@@ -63,7 +55,7 @@ export default class SetupEncryptionBody extends React.Component {
6355

6456
_onStoreUpdate = () => {
6557
const store = SetupEncryptionStore.sharedInstance();
66-
if (store.phase === PHASE_FINISHED) {
58+
if (store.phase === Phase.Finished) {
6759
this.props.onFinished();
6860
return;
6961
}
@@ -136,7 +128,7 @@ export default class SetupEncryptionBody extends React.Component {
136128
onClose={this.props.onFinished}
137129
member={MatrixClientPeg.get().getUser(this.state.verificationRequest.otherUserId)}
138130
/>;
139-
} else if (phase === PHASE_INTRO) {
131+
} else if (phase === Phase.Intro) {
140132
const store = SetupEncryptionStore.sharedInstance();
141133
let recoveryKeyPrompt;
142134
if (store.keyInfo && keyHasPassphrase(store.keyInfo)) {
@@ -174,7 +166,7 @@ export default class SetupEncryptionBody extends React.Component {
174166
</div>
175167
</div>
176168
);
177-
} else if (phase === PHASE_DONE) {
169+
} else if (phase === Phase.Done) {
178170
let message;
179171
if (this.state.backupInfo) {
180172
message = <p>{_t(
@@ -200,7 +192,7 @@ export default class SetupEncryptionBody extends React.Component {
200192
</div>
201193
</div>
202194
);
203-
} else if (phase === PHASE_CONFIRM_SKIP) {
195+
} else if (phase === Phase.ConfirmSkip) {
204196
return (
205197
<div>
206198
<p>{_t(
@@ -224,7 +216,7 @@ export default class SetupEncryptionBody extends React.Component {
224216
</div>
225217
</div>
226218
);
227-
} else if (phase === PHASE_BUSY || phase === PHASE_LOADING) {
219+
} else if (phase === Phase.Busy || phase === Phase.Loading) {
228220
const Spinner = sdk.getComponent('views.elements.Spinner');
229221
return <Spinner />;
230222
} else {

0 commit comments

Comments
 (0)