Remove `MatrixClient.requestVerification` call (#28216)
parent
02e0aca98d
commit
b45b06edad
|
@ -52,7 +52,7 @@ import MatrixClientContext from "../../../contexts/MatrixClientContext";
|
||||||
import { RightPanelPhases } from "../../../stores/right-panel/RightPanelStorePhases";
|
import { RightPanelPhases } from "../../../stores/right-panel/RightPanelStorePhases";
|
||||||
import EncryptionPanel from "./EncryptionPanel";
|
import EncryptionPanel from "./EncryptionPanel";
|
||||||
import { useAsyncMemo } from "../../../hooks/useAsyncMemo";
|
import { useAsyncMemo } from "../../../hooks/useAsyncMemo";
|
||||||
import { legacyVerifyUser, verifyDevice, verifyUser } from "../../../verification";
|
import { verifyDevice, verifyUser } from "../../../verification";
|
||||||
import { Action } from "../../../dispatcher/actions";
|
import { Action } from "../../../dispatcher/actions";
|
||||||
import { useIsEncrypted } from "../../../hooks/useIsEncrypted";
|
import { useIsEncrypted } from "../../../hooks/useIsEncrypted";
|
||||||
import BaseCard from "./BaseCard";
|
import BaseCard from "./BaseCard";
|
||||||
|
@ -1551,13 +1551,7 @@ const BasicUserInfo: React.FC<{
|
||||||
<AccessibleButton
|
<AccessibleButton
|
||||||
kind="link"
|
kind="link"
|
||||||
className="mx_UserInfo_field mx_UserInfo_verifyButton"
|
className="mx_UserInfo_field mx_UserInfo_verifyButton"
|
||||||
onClick={() => {
|
onClick={() => verifyUser(cli, member as User)}
|
||||||
if (hasCrossSigningKeys) {
|
|
||||||
verifyUser(cli, member as User);
|
|
||||||
} else {
|
|
||||||
legacyVerifyUser(cli, member as User);
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
{_t("action|verify")}
|
{_t("action|verify")}
|
||||||
</AccessibleButton>
|
</AccessibleButton>
|
||||||
|
|
|
@ -66,21 +66,6 @@ export async function verifyDevice(matrixClient: MatrixClient, user: User, devic
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function legacyVerifyUser(matrixClient: MatrixClient, user: User): Promise<void> {
|
|
||||||
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<void> {
|
export async function verifyUser(matrixClient: MatrixClient, user: User): Promise<void> {
|
||||||
if (matrixClient.isGuest()) {
|
if (matrixClient.isGuest()) {
|
||||||
dis.dispatch({ action: "require_registration" });
|
dis.dispatch({ action: "require_registration" });
|
||||||
|
|
|
@ -97,7 +97,6 @@ export function createTestClient(): MatrixClient {
|
||||||
getDeviceId: jest.fn().mockReturnValue("ABCDEFGHI"),
|
getDeviceId: jest.fn().mockReturnValue("ABCDEFGHI"),
|
||||||
getStoredCrossSigningForUser: jest.fn(),
|
getStoredCrossSigningForUser: jest.fn(),
|
||||||
getStoredDevice: jest.fn(),
|
getStoredDevice: jest.fn(),
|
||||||
requestVerification: jest.fn(),
|
|
||||||
deviceId: "ABCDEFGHI",
|
deviceId: "ABCDEFGHI",
|
||||||
getDevices: jest.fn().mockResolvedValue({ devices: [{ device_id: "ABCDEFGHI" }] }),
|
getDevices: jest.fn().mockResolvedValue({ devices: [{ device_id: "ABCDEFGHI" }] }),
|
||||||
getSessionId: jest.fn().mockReturnValue("iaszphgvfku"),
|
getSessionId: jest.fn().mockReturnValue("iaszphgvfku"),
|
||||||
|
|
Loading…
Reference in New Issue