From e568bb11e7545bd596ab2700508a990a0c38ff1b Mon Sep 17 00:00:00 2001 From: Florian Duros Date: Wed, 16 Oct 2024 17:09:01 +0200 Subject: [PATCH] Remove `MatrixClient.requestVerification` call --- 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 73bb818bb58..abd0c5ee10e 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 5b6d011ba10..f043e099d84 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 d9f4f3f5a65..643f0baa728 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"),