Get confirmation before enabling encryption
Fixes https://github.com/vector-im/riot-web/issues/8843
This commit is contained in:
parent
8d7837829e
commit
9402e81835
2 changed files with 34 additions and 8 deletions
|
@ -21,6 +21,8 @@ import MatrixClientPeg from "../../../../../MatrixClientPeg";
|
||||||
import sdk from "../../../../..";
|
import sdk from "../../../../..";
|
||||||
import LabelledToggleSwitch from "../../../elements/LabelledToggleSwitch";
|
import LabelledToggleSwitch from "../../../elements/LabelledToggleSwitch";
|
||||||
import {SettingLevel} from "../../../../../settings/SettingsStore";
|
import {SettingLevel} from "../../../../../settings/SettingsStore";
|
||||||
|
import Modal from "../../../../../Modal";
|
||||||
|
import QuestionDialog from "../../../dialogs/QuestionDialog";
|
||||||
|
|
||||||
export default class SecurityRoomSettingsTab extends React.Component {
|
export default class SecurityRoomSettingsTab extends React.Component {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
|
@ -83,6 +85,26 @@ export default class SecurityRoomSettingsTab extends React.Component {
|
||||||
};
|
};
|
||||||
|
|
||||||
_onEncryptionChange = (e) => {
|
_onEncryptionChange = (e) => {
|
||||||
|
Modal.createTrackedDialog('Enable encryption', '', QuestionDialog, {
|
||||||
|
title: _t('Enable encryption?'),
|
||||||
|
description: _t(
|
||||||
|
"Once enabled, encryption for a room cannot be disabled. Messages sent in an encrypted " +
|
||||||
|
"room cannot be seen by the server, only be the participants of the room. Enabling encryption " +
|
||||||
|
"may prevent many bots and bridges from working correctly. <a>Learn more about encryption.</a>",
|
||||||
|
{},
|
||||||
|
{
|
||||||
|
'a': (sub) => {
|
||||||
|
return <a rel='noopener' target='_blank'
|
||||||
|
href='https://about.riot.im/help#end-to-end-encryption'>{sub}</a>;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
),
|
||||||
|
onFinished: (confirm) => {
|
||||||
|
if (!confirm) {
|
||||||
|
this.setState({encrypted: false});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const beforeEncrypted = this.state.encrypted;
|
const beforeEncrypted = this.state.encrypted;
|
||||||
this.setState({encrypted: true});
|
this.setState({encrypted: true});
|
||||||
MatrixClientPeg.get().sendStateEvent(
|
MatrixClientPeg.get().sendStateEvent(
|
||||||
|
@ -92,6 +114,8 @@ export default class SecurityRoomSettingsTab extends React.Component {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
this.setState({encrypted: beforeEncrypted});
|
this.setState({encrypted: beforeEncrypted});
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
_fixGuestAccess = (e) => {
|
_fixGuestAccess = (e) => {
|
||||||
|
|
|
@ -612,6 +612,8 @@
|
||||||
"To send events of type <eventType/>, you must be a": "To send events of type <eventType/>, you must be a",
|
"To send events of type <eventType/>, you must be a": "To send events of type <eventType/>, you must be a",
|
||||||
"Roles & Permissions": "Roles & Permissions",
|
"Roles & Permissions": "Roles & Permissions",
|
||||||
"Permissions": "Permissions",
|
"Permissions": "Permissions",
|
||||||
|
"Enable encryption?": "Enable encryption?",
|
||||||
|
"Once enabled, encryption for a room cannot be disabled. Messages sent in an encrypted room cannot be seen by the server, only be the participants of the room. Enabling encryption may prevent many bots and bridges from working correctly. <a>Learn more about encryption.</a>": "Once enabled, encryption for a room cannot be disabled. Messages sent in an encrypted room cannot be seen by the server, only be the participants of the room. Enabling encryption may prevent many bots and bridges from working correctly. <a>Learn more about encryption.</a>",
|
||||||
"Guests cannot join this room even if explicitly invited.": "Guests cannot join this room even if explicitly invited.",
|
"Guests cannot join this room even if explicitly invited.": "Guests cannot join this room even if explicitly invited.",
|
||||||
"Click here to fix": "Click here to fix",
|
"Click here to fix": "Click here to fix",
|
||||||
"To link to this room, please add an alias.": "To link to this room, please add an alias.",
|
"To link to this room, please add an alias.": "To link to this room, please add an alias.",
|
||||||
|
|
Loading…
Reference in a new issue