You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-08 21:42:24 +03:00
Tests for MKeyVerificationConclusion
This commit is contained in:
@@ -32,6 +32,7 @@ export default class MKeyVerificationConclusion extends React.Component {
|
||||
if (request) {
|
||||
request.on("change", this._onRequestChanged);
|
||||
}
|
||||
MatrixClientPeg.get().on("userTrustStatusChanged", this._onTrustChanged);
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
@@ -39,12 +40,22 @@ export default class MKeyVerificationConclusion extends React.Component {
|
||||
if (request) {
|
||||
request.off("change", this._onRequestChanged);
|
||||
}
|
||||
MatrixClientPeg.removeListener("userTrustStatusChanged", this._onTrustChanged);
|
||||
}
|
||||
|
||||
_onRequestChanged = () => {
|
||||
this.forceUpdate();
|
||||
};
|
||||
|
||||
_onTrustChanged = (userId, status) => {
|
||||
const { mxEvent } = this.props;
|
||||
const request = mxEvent.verificationRequest;
|
||||
if (!request || request.otherUserId !== userId) {
|
||||
return;
|
||||
}
|
||||
this.forceUpdate();
|
||||
};
|
||||
|
||||
_shouldRender(mxEvent, request) {
|
||||
// normally should not happen
|
||||
if (!request) {
|
||||
@@ -66,7 +77,7 @@ export default class MKeyVerificationConclusion extends React.Component {
|
||||
|
||||
// User isn't actually verified
|
||||
if (!MatrixClientPeg.get()
|
||||
.checkUserTrust(mxEvent.verificationRequest.otherUserId)
|
||||
.checkUserTrust(request.otherUserId)
|
||||
.isCrossSigningVerified()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user