Add new verification section to user profile (#29200)
* Create new verification section * Remove old code and use new VerificationSection * Add styling and translation * Fix tests * Remove dead code * Fix broken test * Remove imports * Remove console.log * Update snapshots * Fix broken tests * Fix lint * Make badge expand with content * Remove unused code
This commit is contained in:
@@ -10,11 +10,8 @@ import { type User, type MatrixClient, type RoomMember } from "matrix-js-sdk/src
|
||||
import { CrossSigningKey, type VerificationRequest } from "matrix-js-sdk/src/crypto-api";
|
||||
|
||||
import dis from "./dispatcher/dispatcher";
|
||||
import Modal from "./Modal";
|
||||
import { RightPanelPhases } from "./stores/right-panel/RightPanelStorePhases";
|
||||
import { accessSecretStorage } from "./SecurityManager";
|
||||
import UntrustedDeviceDialog from "./components/views/dialogs/UntrustedDeviceDialog";
|
||||
import { type IDevice } from "./components/views/right_panel/UserInfo";
|
||||
import RightPanelStore from "./stores/right-panel/RightPanelStore";
|
||||
import { type IRightPanelCardState } from "./stores/right-panel/RightPanelStoreIPanelState";
|
||||
import { findDMForUser } from "./utils/dm/findDMForUser";
|
||||
@@ -31,32 +28,6 @@ async function enable4SIfNeeded(matrixClient: MatrixClient): Promise<boolean> {
|
||||
return true;
|
||||
}
|
||||
|
||||
export async function verifyDevice(matrixClient: MatrixClient, user: User, device: IDevice): 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.getCrypto()?.getTrustCrossSignedDevices()) {
|
||||
if (!(await enable4SIfNeeded(matrixClient))) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Modal.createDialog(UntrustedDeviceDialog, {
|
||||
user,
|
||||
device,
|
||||
onFinished: async (action): Promise<void> => {
|
||||
if (action === "sas") {
|
||||
const verificationRequestPromise = matrixClient
|
||||
.getCrypto()
|
||||
?.requestDeviceVerification(user.userId, device.deviceId);
|
||||
setRightPanel({ member: user, verificationRequestPromise });
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export async function verifyUser(matrixClient: MatrixClient, user: User): Promise<void> {
|
||||
if (matrixClient.isGuest()) {
|
||||
dis.dispatch({ action: "require_registration" });
|
||||
|
||||
Reference in New Issue
Block a user