Remove references to VerificationRequest (#11050)

* Update references to `VerificationRequestEvent`

* Update references to `Phase`

* update references to legacy `PHASE_*` constants

* Replace `request.canAccept` with `canAcceptVerificationRequest`

* Replace `VerificationRequest` with the interface throughout

* Minor strict type fixes

* Add a couple of tests
This commit is contained in:
Richard van der Hoff 2023-06-14 15:35:32 +01:00 committed by GitHub
parent 6486255f54
commit b9b93264b6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 72 additions and 57 deletions

View file

@ -18,9 +18,10 @@ import React from "react";
import { MatrixEvent, User } from "matrix-js-sdk/src/matrix";
import { logger } from "matrix-js-sdk/src/logger";
import {
Phase as VerificationPhase,
canAcceptVerificationRequest,
VerificationPhase,
VerificationRequestEvent,
} from "matrix-js-sdk/src/crypto/verification/request/VerificationRequest";
} from "matrix-js-sdk/src/crypto-api";
import { MatrixClientPeg } from "../../../MatrixClientPeg";
import { _t } from "../../../languageHandler";
@ -139,7 +140,7 @@ export default class MKeyVerificationRequest extends React.Component<IProps> {
let subtitle: string;
let stateNode: JSX.Element | undefined;
if (!request.canAccept) {
if (!canAcceptVerificationRequest(request)) {
let stateLabel;
const accepted =
request.phase === VerificationPhase.Ready ||
@ -165,7 +166,7 @@ export default class MKeyVerificationRequest extends React.Component<IProps> {
const name = getNameForEventRoom(client, request.otherUserId, mxEvent.getRoomId()!);
title = _t("%(name)s wants to verify", { name });
subtitle = userLabelForEventRoom(client, request.otherUserId, mxEvent.getRoomId()!);
if (request.canAccept) {
if (canAcceptVerificationRequest(request)) {
stateNode = (
<div className="mx_cryptoEvent_buttons">
<AccessibleButton kind="danger" onClick={this.onRejectClicked}>