From 3d47e259553d15c6e6d1b08b10a2070c42f7c4a6 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 29 Jan 2020 07:53:45 +0000 Subject: [PATCH] improve PropTypes for better rageshakes --- .../views/right_panel/VerificationPanel.js | 19 ++++++++++++++++++- .../views/verification/VerificationShowSas.js | 3 ++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/components/views/right_panel/VerificationPanel.js b/src/components/views/right_panel/VerificationPanel.js index 3740c6e49d..46179183e1 100644 --- a/src/components/views/right_panel/VerificationPanel.js +++ b/src/components/views/right_panel/VerificationPanel.js @@ -14,7 +14,8 @@ See the License for the specific language governing permissions and limitations under the License. */ -import React from 'react'; +import React from "react"; +import PropTypes from "prop-types"; import * as sdk from '../../../index'; import {verificationMethods} from 'matrix-js-sdk/src/crypto'; @@ -23,6 +24,8 @@ import {MatrixClientPeg} from "../../../MatrixClientPeg"; import {_t} from "../../../languageHandler"; import E2EIcon from "../rooms/E2EIcon"; import { + PHASE_UNSENT, + PHASE_REQUESTED, PHASE_READY, PHASE_DONE, PHASE_STARTED, @@ -31,6 +34,20 @@ import { import Spinner from "../elements/Spinner"; export default class VerificationPanel extends React.PureComponent { + static propTypes = { + request: PropTypes.object.isRequired, + member: PropTypes.object.isRequired, + phase: PropTypes.oneOf([ + PHASE_UNSENT, + PHASE_REQUESTED, + PHASE_READY, + PHASE_STARTED, + PHASE_CANCELLED, + PHASE_DONE, + ]).isRequired, + onClose: PropTypes.func.isRequired, + }; + constructor(props) { super(props); this.state = {}; diff --git a/src/components/views/verification/VerificationShowSas.js b/src/components/views/verification/VerificationShowSas.js index ec222159ab..aee0f57cf8 100644 --- a/src/components/views/verification/VerificationShowSas.js +++ b/src/components/views/verification/VerificationShowSas.js @@ -27,7 +27,8 @@ function capFirst(s) { export default class VerificationShowSas extends React.Component { static propTypes = { - displayName: PropTypes.string.isRequired, + pending: PropTypes.bool, + displayName: PropTypes.string, // required if pending is true onDone: PropTypes.func.isRequired, onCancel: PropTypes.func.isRequired, sas: PropTypes.object.isRequired,