From b45b06edad9725ee898cb17bd9fcb6808113c0b1 Mon Sep 17 00:00:00 2001 From: Florian Duros Date: Mon, 21 Oct 2024 12:47:00 +0200 Subject: [PATCH] Remove `MatrixClient.requestVerification` call (#28216) --- src/components/views/right_panel/UserInfo.tsx | 10 ++-------- src/verification.ts | 15 --------------- test/test-utils/test-utils.ts | 1 - 3 files changed, 2 insertions(+), 24 deletions(-) diff --git a/src/components/views/right_panel/UserInfo.tsx b/src/components/views/right_panel/UserInfo.tsx index d6f4b0300a..d07b3566e2 100644 --- a/src/components/views/right_panel/UserInfo.tsx +++ b/src/components/views/right_panel/UserInfo.tsx @@ -52,7 +52,7 @@ import MatrixClientContext from "../../../contexts/MatrixClientContext"; import { RightPanelPhases } from "../../../stores/right-panel/RightPanelStorePhases"; import EncryptionPanel from "./EncryptionPanel"; import { useAsyncMemo } from "../../../hooks/useAsyncMemo"; -import { legacyVerifyUser, verifyDevice, verifyUser } from "../../../verification"; +import { verifyDevice, verifyUser } from "../../../verification"; import { Action } from "../../../dispatcher/actions"; import { useIsEncrypted } from "../../../hooks/useIsEncrypted"; import BaseCard from "./BaseCard"; @@ -1551,13 +1551,7 @@ const BasicUserInfo: React.FC<{ { - if (hasCrossSigningKeys) { - verifyUser(cli, member as User); - } else { - legacyVerifyUser(cli, member as User); - } - }} + onClick={() => verifyUser(cli, member as User)} > {_t("action|verify")} diff --git a/src/verification.ts b/src/verification.ts index 5b6d011ba1..f043e099d8 100644 --- a/src/verification.ts +++ b/src/verification.ts @@ -66,21 +66,6 @@ export async function verifyDevice(matrixClient: MatrixClient, user: User, devic }); } -export async function legacyVerifyUser(matrixClient: MatrixClient, user: User): Promise { - if (matrixClient.isGuest()) { - dis.dispatch({ action: "require_registration" }); - return; - } - // if cross-signing is not explicitly disabled, check if it should be enabled first. - if (matrixClient.getCryptoTrustCrossSignedDevices()) { - if (!(await enable4SIfNeeded(matrixClient))) { - return; - } - } - const verificationRequestPromise = matrixClient.requestVerification(user.userId); - setRightPanel({ member: user, verificationRequestPromise }); -} - export async function verifyUser(matrixClient: MatrixClient, user: User): Promise { if (matrixClient.isGuest()) { dis.dispatch({ action: "require_registration" }); diff --git a/test/test-utils/test-utils.ts b/test/test-utils/test-utils.ts index 33219eca35..e34af523ee 100644 --- a/test/test-utils/test-utils.ts +++ b/test/test-utils/test-utils.ts @@ -97,7 +97,6 @@ export function createTestClient(): MatrixClient { getDeviceId: jest.fn().mockReturnValue("ABCDEFGHI"), getStoredCrossSigningForUser: jest.fn(), getStoredDevice: jest.fn(), - requestVerification: jest.fn(), deviceId: "ABCDEFGHI", getDevices: jest.fn().mockResolvedValue({ devices: [{ device_id: "ABCDEFGHI" }] }), getSessionId: jest.fn().mockReturnValue("iaszphgvfku"),