From ab2e3a346599a4f092d43dc8d2de94954ac34f88 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Tue, 10 Mar 2020 16:54:49 +0100 Subject: [PATCH] also enable 4s when accepting a verification request --- src/components/views/toasts/VerificationRequestToast.js | 4 ++++ src/verification.js | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/views/toasts/VerificationRequestToast.js b/src/components/views/toasts/VerificationRequestToast.js index c11cefc839..f590cecc3e 100644 --- a/src/components/views/toasts/VerificationRequestToast.js +++ b/src/components/views/toasts/VerificationRequestToast.js @@ -24,6 +24,7 @@ import {userLabelForEventRoom} from "../../../utils/KeyVerificationStateObserver import dis from "../../../dispatcher"; import ToastStore from "../../../stores/ToastStore"; import Modal from "../../../Modal"; +import {enable4SIfNeeded} from "../../../verification"; export default class VerificationRequestToast extends React.PureComponent { constructor(props) { @@ -73,6 +74,9 @@ export default class VerificationRequestToast extends React.PureComponent { } accept = async () => { + if (!await enable4SIfNeeded()) { + return; + } ToastStore.sharedInstance().dismissToast(this.props.toastKey); const {request} = this.props; // no room id for to_device requests diff --git a/src/verification.js b/src/verification.js index f110a9632a..cdce9c6d32 100644 --- a/src/verification.js +++ b/src/verification.js @@ -24,7 +24,7 @@ import {findDMForUser} from './createRoom'; import {accessSecretStorage} from './CrossSigningManager'; import SettingsStore from './settings/SettingsStore'; -async function enable4SIfNeeded() { +export async function enable4SIfNeeded() { const cli = MatrixClientPeg.get(); if (!cli.isCryptoEnabled() || !SettingsStore.isFeatureEnabled("feature_cross_signing")) { return false;