From cc68f53fc2854bd52df22bdc6bef91668c2c9828 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 27 May 2020 10:47:01 +0100 Subject: [PATCH] tidy up and delint Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/structures/MatrixChat.tsx | 3 --- src/components/structures/RightPanel.js | 19 +++++-------------- .../views/dialogs/DeviceVerifyDialog.js | 8 ++------ src/components/views/dialogs/InviteDialog.js | 1 - .../keybackup/RestoreKeyBackupDialog.js | 2 -- .../views/settings/KeyBackupPanel.js | 1 - .../tabs/user/SecurityUserSettingsTab.js | 2 +- 7 files changed, 8 insertions(+), 28 deletions(-) diff --git a/src/components/structures/MatrixChat.tsx b/src/components/structures/MatrixChat.tsx index 2bebdd1e79..125828689d 100644 --- a/src/components/structures/MatrixChat.tsx +++ b/src/components/structures/MatrixChat.tsx @@ -1937,9 +1937,6 @@ export default class MatrixChat extends React.PureComponent { } if (await cli.doesServerSupportUnstableFeature("org.matrix.e2e_cross_signing")) { - // This will only work if the feature is set to 'enable' in the config, - // since it's too early in the lifecycle for users to have turned the - // labs flag on. this.setStateForNewView({ view: Views.E2E_SETUP }); } else { this.onLoggedIn(); diff --git a/src/components/structures/RightPanel.js b/src/components/structures/RightPanel.js index 811feb8614..776130e709 100644 --- a/src/components/structures/RightPanel.js +++ b/src/components/structures/RightPanel.js @@ -26,7 +26,6 @@ import dis from '../../dispatcher/dispatcher'; import RateLimitedFunc from '../../ratelimitedfunc'; import { showGroupInviteDialog, showGroupAddRoomDialog } from '../../GroupAddressPicker'; import GroupStore from '../../stores/GroupStore'; -import SettingsStore from "../../settings/SettingsStore"; import {RIGHT_PANEL_PHASES, RIGHT_PANEL_PHASES_NO_ARGS} from "../../stores/RightPanelStorePhases"; import RightPanelStore from "../../stores/RightPanelStore"; import MatrixClientContext from "../../contexts/MatrixClientContext"; @@ -189,7 +188,7 @@ export default class RightPanel extends React.Component { } } - onCloseRoomMemberInfo = () => { + onCloseUserInfo = () => { // XXX: There are three different ways of 'closing' this panel depending on what state // things are in... this knows far more than it should do about the state of the rest // of the app and is generally a bit silly. @@ -203,23 +202,15 @@ export default class RightPanel extends React.Component { }); } else { // Otherwise we have got our user from RoomViewStore which means we're being shown - // within a room, so go back to the member panel if we were in the encryption panel, + // within a room/group, so go back to the member panel if we were in the encryption panel, // or the member list if we were in the member panel... phew. dis.dispatch({ action: Action.ViewUser, - member: this.state.phase === RIGHT_PANEL_PHASES.EncryptionPanel ? - this.state.member : null, + member: this.state.phase === RIGHT_PANEL_PHASES.EncryptionPanel ? this.state.member : null, }); } }; - onCloseGroupMemberInfo = () => { - dis.dispatch({ - action: Action.ViewUser, - member: null, - }); - }; - render() { const MemberList = sdk.getComponent('rooms.MemberList'); const UserInfo = sdk.getComponent('right_panel.UserInfo'); @@ -253,7 +244,7 @@ export default class RightPanel extends React.Component { user={this.state.member} roomId={this.props.roomId} key={this.props.roomId || this.state.member.userId} - onClose={this.onCloseRoomMemberInfo} + onClose={this.onCloseUserInfo} phase={this.state.phase} verificationRequest={this.state.verificationRequest} verificationRequestPromise={this.state.verificationRequestPromise} @@ -267,7 +258,7 @@ export default class RightPanel extends React.Component { user={this.state.member} groupId={this.props.groupId} key={this.state.member.userId} - onClose={this.onCloseGroupMemberInfo} />; + onClose={this.onCloseUserInfo} />; break; case RIGHT_PANEL_PHASES.GroupRoomInfo: panel = r.ready || r.started); this.setState({phase: PHASE_PICK_VERIFICATION_OPTION}); - } else { - this._verifier = client.beginKeyVerification( - verificationMethods.SAS, this.props.userId, this.props.device.deviceId, - ); } + if (!this._verifier) return; this._verifier.on('show_sas', this._onVerifierShowSas); // throws upon cancellation diff --git a/src/components/views/dialogs/InviteDialog.js b/src/components/views/dialogs/InviteDialog.js index 79eb1b5b9d..c245ba35aa 100644 --- a/src/components/views/dialogs/InviteDialog.js +++ b/src/components/views/dialogs/InviteDialog.js @@ -33,7 +33,6 @@ import Modal from "../../../Modal"; import {humanizeTime} from "../../../utils/humanize"; import createRoom, {canEncryptToAllUsers} from "../../../createRoom"; import {inviteMultipleToRoom} from "../../../RoomInvite"; -import SettingsStore from '../../../settings/SettingsStore'; import {Key} from "../../../Keyboard"; import {Action} from "../../../dispatcher/actions"; import {RoomListStoreTempProxy} from "../../../stores/room-list/RoomListStoreTempProxy"; diff --git a/src/components/views/dialogs/keybackup/RestoreKeyBackupDialog.js b/src/components/views/dialogs/keybackup/RestoreKeyBackupDialog.js index 4944c4b5ee..a27853db56 100644 --- a/src/components/views/dialogs/keybackup/RestoreKeyBackupDialog.js +++ b/src/components/views/dialogs/keybackup/RestoreKeyBackupDialog.js @@ -20,10 +20,8 @@ import PropTypes from 'prop-types'; import * as sdk from '../../../../index'; import {MatrixClientPeg} from '../../../../MatrixClientPeg'; import { MatrixClient } from 'matrix-js-sdk'; -import Modal from '../../../../Modal'; import { _t } from '../../../../languageHandler'; import { accessSecretStorage } from '../../../../CrossSigningManager'; -import SettingsStore from "../../../../settings/SettingsStore"; const RESTORE_TYPE_PASSPHRASE = 0; const RESTORE_TYPE_RECOVERYKEY = 1; diff --git a/src/components/views/settings/KeyBackupPanel.js b/src/components/views/settings/KeyBackupPanel.js index d09870d5e3..a7a2c768db 100644 --- a/src/components/views/settings/KeyBackupPanel.js +++ b/src/components/views/settings/KeyBackupPanel.js @@ -21,7 +21,6 @@ import * as sdk from '../../../index'; import {MatrixClientPeg} from '../../../MatrixClientPeg'; import { _t } from '../../../languageHandler'; import Modal from '../../../Modal'; -import SettingsStore from '../../../settings/SettingsStore'; export default class KeyBackupPanel extends React.PureComponent { constructor(props) { diff --git a/src/components/views/settings/tabs/user/SecurityUserSettingsTab.js b/src/components/views/settings/tabs/user/SecurityUserSettingsTab.js index a410617631..b3c3f63d72 100644 --- a/src/components/views/settings/tabs/user/SecurityUserSettingsTab.js +++ b/src/components/views/settings/tabs/user/SecurityUserSettingsTab.js @@ -17,7 +17,7 @@ limitations under the License. import React from 'react'; import PropTypes from 'prop-types'; import {_t} from "../../../../../languageHandler"; -import SettingsStore, {SettingLevel} from "../../../../../settings/SettingsStore"; +import {SettingLevel} from "../../../../../settings/SettingsStore"; import {MatrixClientPeg} from "../../../../../MatrixClientPeg"; import * as FormattingUtils from "../../../../../utils/FormattingUtils"; import AccessibleButton from "../../../elements/AccessibleButton";