Fix enum casing once again

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
Šimon Brandner 2021-09-21 08:18:49 +02:00
parent 6d916bfdde
commit f84a98b933
No known key found for this signature in database
GPG key ID: 55C211A1226CB17D
5 changed files with 34 additions and 34 deletions

View file

@ -19,7 +19,7 @@ import { User } from "matrix-js-sdk/src/models/user";
import { _t } from "../../../languageHandler"; import { _t } from "../../../languageHandler";
import { MatrixClientPeg } from "../../../MatrixClientPeg"; import { MatrixClientPeg } from "../../../MatrixClientPeg";
import E2EIcon, { E2E_STATE } from "../rooms/E2EIcon"; import E2EIcon, { E2EState } from "../rooms/E2EIcon";
import AccessibleButton from "../elements/AccessibleButton"; import AccessibleButton from "../elements/AccessibleButton";
import BaseDialog from "./BaseDialog"; import BaseDialog from "./BaseDialog";
import { IDialogProps } from "./IDialogProps"; import { IDialogProps } from "./IDialogProps";
@ -47,7 +47,7 @@ const UntrustedDeviceDialog: React.FC<IProps> = ({ device, user, onFinished }) =
onFinished={onFinished} onFinished={onFinished}
className="mx_UntrustedDeviceDialog" className="mx_UntrustedDeviceDialog"
title={<> title={<>
<E2EIcon status={E2E_STATE.Warning} size={24} hideTooltip={true} /> <E2EIcon status={E2EState.Warning} size={24} hideTooltip={true} />
{ _t("Not Trusted") } { _t("Not Trusted") }
</>} </>}
> >

View file

@ -28,7 +28,7 @@ import { SAS } from "matrix-js-sdk/src/crypto/verification/SAS";
import VerificationQRCode from "../elements/crypto/VerificationQRCode"; import VerificationQRCode from "../elements/crypto/VerificationQRCode";
import { _t } from "../../../languageHandler"; import { _t } from "../../../languageHandler";
import SdkConfig from "../../../SdkConfig"; import SdkConfig from "../../../SdkConfig";
import E2EIcon, { E2E_STATE } from "../rooms/E2EIcon"; import E2EIcon, { E2EState } from "../rooms/E2EIcon";
import { Phase } from "matrix-js-sdk/src/crypto/verification/request/VerificationRequest"; import { Phase } from "matrix-js-sdk/src/crypto/verification/request/VerificationRequest";
import Spinner from "../elements/Spinner"; import Spinner from "../elements/Spinner";
import { replaceableComponent } from "../../../utils/replaceableComponent"; import { replaceableComponent } from "../../../utils/replaceableComponent";
@ -189,7 +189,7 @@ export default class VerificationPanel extends React.PureComponent<IProps, IStat
// Element Web doesn't support scanning yet, so assume here we're the client being scanned. // Element Web doesn't support scanning yet, so assume here we're the client being scanned.
body = <React.Fragment> body = <React.Fragment>
<p>{ description }</p> <p>{ description }</p>
<E2EIcon isUser={true} status={E2E_STATE.Verified} size={128} hideTooltip={true} /> <E2EIcon isUser={true} status={E2EState.Verified} size={128} hideTooltip={true} />
<div className="mx_VerificationPanel_reciprocateButtons"> <div className="mx_VerificationPanel_reciprocateButtons">
<AccessibleButton <AccessibleButton
kind="danger" kind="danger"
@ -252,7 +252,7 @@ export default class VerificationPanel extends React.PureComponent<IProps, IStat
<div className="mx_UserInfo_container mx_VerificationPanel_verified_section"> <div className="mx_UserInfo_container mx_VerificationPanel_verified_section">
<h3>{ _t("Verified") }</h3> <h3>{ _t("Verified") }</h3>
<p>{ description }</p> <p>{ description }</p>
<E2EIcon isUser={true} status={E2E_STATE.Verified} size={128} hideTooltip={true} /> <E2EIcon isUser={true} status={E2EState.Verified} size={128} hideTooltip={true} />
{ text ? <p>{ text }</p> : null } { text ? <p>{ text }</p> : null }
<AccessibleButton kind="primary" className="mx_UserInfo_wideButton" onClick={this.props.onClose}> <AccessibleButton kind="primary" className="mx_UserInfo_wideButton" onClick={this.props.onClose}>
{ _t("Got it") } { _t("Got it") }

View file

@ -23,7 +23,7 @@ import AccessibleButton from "../elements/AccessibleButton";
import Tooltip from "../elements/Tooltip"; import Tooltip from "../elements/Tooltip";
import { E2EStatus } from "../../../utils/ShieldUtils"; import { E2EStatus } from "../../../utils/ShieldUtils";
export enum E2E_STATE { export enum E2EState {
Verified = "verified", Verified = "verified",
Warning = "warning", Warning = "warning",
Unknown = "unknown", Unknown = "unknown",
@ -31,20 +31,20 @@ export enum E2E_STATE {
Unauthenticated = "unauthenticated", Unauthenticated = "unauthenticated",
} }
const crossSigningUserTitles: { [key in E2E_STATE]?: string } = { const crossSigningUserTitles: { [key in E2EState]?: string } = {
[E2E_STATE.Warning]: _td("This user has not verified all of their sessions."), [E2EState.Warning]: _td("This user has not verified all of their sessions."),
[E2E_STATE.Normal]: _td("You have not verified this user."), [E2EState.Normal]: _td("You have not verified this user."),
[E2E_STATE.Verified]: _td("You have verified this user. This user has verified all of their sessions."), [E2EState.Verified]: _td("You have verified this user. This user has verified all of their sessions."),
}; };
const crossSigningRoomTitles: { [key in E2E_STATE]?: string } = { const crossSigningRoomTitles: { [key in E2EState]?: string } = {
[E2E_STATE.Warning]: _td("Someone is using an unknown session"), [E2EState.Warning]: _td("Someone is using an unknown session"),
[E2E_STATE.Normal]: _td("This room is end-to-end encrypted"), [E2EState.Normal]: _td("This room is end-to-end encrypted"),
[E2E_STATE.Verified]: _td("Everyone in this room is verified"), [E2EState.Verified]: _td("Everyone in this room is verified"),
}; };
interface IProps { interface IProps {
isUser?: boolean; isUser?: boolean;
status?: E2E_STATE | E2EStatus; status?: E2EState | E2EStatus;
className?: string; className?: string;
size?: number; size?: number;
onClick?: () => void; onClick?: () => void;
@ -58,9 +58,9 @@ const E2EIcon: React.FC<IProps> = ({ isUser, status, className, size, onClick, h
const classes = classNames({ const classes = classNames({
mx_E2EIcon: true, mx_E2EIcon: true,
mx_E2EIcon_bordered: bordered, mx_E2EIcon_bordered: bordered,
mx_E2EIcon_warning: status === E2E_STATE.Warning, mx_E2EIcon_warning: status === E2EState.Warning,
mx_E2EIcon_normal: status === E2E_STATE.Normal, mx_E2EIcon_normal: status === E2EState.Normal,
mx_E2EIcon_verified: status === E2E_STATE.Verified, mx_E2EIcon_verified: status === E2EState.Verified,
}, className); }, className);
let e2eTitle; let e2eTitle;

View file

@ -20,7 +20,7 @@ import React from 'react';
import AccessibleButton from '../elements/AccessibleButton'; import AccessibleButton from '../elements/AccessibleButton';
import { _td } from '../../../languageHandler'; import { _td } from '../../../languageHandler';
import classNames from "classnames"; import classNames from "classnames";
import E2EIcon, { E2E_STATE } from './E2EIcon'; import E2EIcon, { E2EState } from './E2EIcon';
import { replaceableComponent } from "../../../utils/replaceableComponent"; import { replaceableComponent } from "../../../utils/replaceableComponent";
import BaseAvatar from '../avatars/BaseAvatar'; import BaseAvatar from '../avatars/BaseAvatar';
import PresenceLabel from "./PresenceLabel"; import PresenceLabel from "./PresenceLabel";
@ -75,7 +75,7 @@ interface IProps {
suppressOnHover?: boolean; suppressOnHover?: boolean;
showPresence?: boolean; showPresence?: boolean;
subtextLabel?: string; subtextLabel?: string;
e2eStatus?: E2E_STATE; e2eStatus?: E2EState;
powerStatus?: PowerStatus; powerStatus?: PowerStatus;
} }

View file

@ -33,7 +33,7 @@ import { formatTime } from "../../../DateUtils";
import { MatrixClientPeg } from '../../../MatrixClientPeg'; import { MatrixClientPeg } from '../../../MatrixClientPeg';
import { ALL_RULE_TYPES } from "../../../mjolnir/BanList"; import { ALL_RULE_TYPES } from "../../../mjolnir/BanList";
import MatrixClientContext from "../../../contexts/MatrixClientContext"; import MatrixClientContext from "../../../contexts/MatrixClientContext";
import { E2E_STATE } from "./E2EIcon"; import { E2EState } from "./E2EIcon";
import { toRem } from "../../../utils/units"; import { toRem } from "../../../utils/units";
import { WidgetType } from "../../../widgets/WidgetType"; import { WidgetType } from "../../../widgets/WidgetType";
import RoomAvatar from "../avatars/RoomAvatar"; import RoomAvatar from "../avatars/RoomAvatar";
@ -605,7 +605,7 @@ export default class EventTile extends React.Component<IProps, IState> {
if (encryptionInfo.mismatchedSender) { if (encryptionInfo.mismatchedSender) {
// something definitely wrong is going on here // something definitely wrong is going on here
this.setState({ this.setState({
verified: E2E_STATE.Warning, verified: E2EState.Warning,
}, this.props.onHeightChanged); // Decryption may have caused a change in size }, this.props.onHeightChanged); // Decryption may have caused a change in size
return; return;
} }
@ -613,7 +613,7 @@ export default class EventTile extends React.Component<IProps, IState> {
if (!userTrust.isCrossSigningVerified()) { if (!userTrust.isCrossSigningVerified()) {
// user is not verified, so default to everything is normal // user is not verified, so default to everything is normal
this.setState({ this.setState({
verified: E2E_STATE.Normal, verified: E2EState.Normal,
}, this.props.onHeightChanged); // Decryption may have caused a change in size }, this.props.onHeightChanged); // Decryption may have caused a change in size
return; return;
} }
@ -623,27 +623,27 @@ export default class EventTile extends React.Component<IProps, IState> {
); );
if (!eventSenderTrust) { if (!eventSenderTrust) {
this.setState({ this.setState({
verified: E2E_STATE.Unknown, verified: E2EState.Unknown,
}, this.props.onHeightChanged); // Decryption may have caused a change in size }, this.props.onHeightChanged); // Decryption may have caused a change in size
return; return;
} }
if (!eventSenderTrust.isVerified()) { if (!eventSenderTrust.isVerified()) {
this.setState({ this.setState({
verified: E2E_STATE.Warning, verified: E2EState.Warning,
}, this.props.onHeightChanged); // Decryption may have caused a change in size }, this.props.onHeightChanged); // Decryption may have caused a change in size
return; return;
} }
if (!encryptionInfo.authenticated) { if (!encryptionInfo.authenticated) {
this.setState({ this.setState({
verified: E2E_STATE.Unauthenticated, verified: E2EState.Unauthenticated,
}, this.props.onHeightChanged); // Decryption may have caused a change in size }, this.props.onHeightChanged); // Decryption may have caused a change in size
return; return;
} }
this.setState({ this.setState({
verified: E2E_STATE.Verified, verified: E2EState.Verified,
}, this.props.onHeightChanged); // Decryption may have caused a change in size }, this.props.onHeightChanged); // Decryption may have caused a change in size
} }
@ -850,13 +850,13 @@ export default class EventTile extends React.Component<IProps, IState> {
// event is encrypted, display padlock corresponding to whether or not it is verified // event is encrypted, display padlock corresponding to whether or not it is verified
if (ev.isEncrypted()) { if (ev.isEncrypted()) {
if (this.state.verified === E2E_STATE.Normal) { if (this.state.verified === E2EState.Normal) {
return; // no icon if we've not even cross-signed the user return; // no icon if we've not even cross-signed the user
} else if (this.state.verified === E2E_STATE.Verified) { } else if (this.state.verified === E2EState.Verified) {
return; // no icon for verified return; // no icon for verified
} else if (this.state.verified === E2E_STATE.Unauthenticated) { } else if (this.state.verified === E2EState.Unauthenticated) {
return (<E2ePadlockUnauthenticated />); return (<E2ePadlockUnauthenticated />);
} else if (this.state.verified === E2E_STATE.Unknown) { } else if (this.state.verified === E2EState.Unknown) {
return (<E2ePadlockUnknown />); return (<E2ePadlockUnknown />);
} else { } else {
return (<E2ePadlockUnverified />); return (<E2ePadlockUnverified />);
@ -961,9 +961,9 @@ export default class EventTile extends React.Component<IProps, IState> {
mx_EventTile_lastInSection: this.props.lastInSection, mx_EventTile_lastInSection: this.props.lastInSection,
mx_EventTile_contextual: this.props.contextual, mx_EventTile_contextual: this.props.contextual,
mx_EventTile_actionBarFocused: this.state.actionBarFocused, mx_EventTile_actionBarFocused: this.state.actionBarFocused,
mx_EventTile_verified: !isBubbleMessage && this.state.verified === E2E_STATE.Verified, mx_EventTile_verified: !isBubbleMessage && this.state.verified === E2EState.Verified,
mx_EventTile_unverified: !isBubbleMessage && this.state.verified === E2E_STATE.Warning, mx_EventTile_unverified: !isBubbleMessage && this.state.verified === E2EState.Warning,
mx_EventTile_unknown: !isBubbleMessage && this.state.verified === E2E_STATE.Unknown, mx_EventTile_unknown: !isBubbleMessage && this.state.verified === E2EState.Unknown,
mx_EventTile_bad: isEncryptionFailure, mx_EventTile_bad: isEncryptionFailure,
mx_EventTile_emote: msgtype === 'm.emote', mx_EventTile_emote: msgtype === 'm.emote',
mx_EventTile_noSender: this.props.hideSender, mx_EventTile_noSender: this.props.hideSender,