From c478b4efb5b6877d2500787ed05d5c74fcbd122c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Brandner?= Date: Mon, 12 Jul 2021 19:20:19 +0200 Subject: [PATCH] Improve "Are you sure you want to make this encrypted room public?" dialog MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Šimon Brandner --- res/css/_common.scss | 5 ++ .../tabs/room/SecurityRoomSettingsTab.tsx | 47 +++++++++++++++---- src/i18n/strings/en_EN.json | 5 +- 3 files changed, 46 insertions(+), 11 deletions(-) diff --git a/res/css/_common.scss b/res/css/_common.scss index b128a82442..97d2acc1af 100644 --- a/res/css/_common.scss +++ b/res/css/_common.scss @@ -381,6 +381,11 @@ input[type=text]:focus, input[type=password]:focus, textarea:focus { font-size: $font-14px; color: $primary-fg-color; word-wrap: break-word; + + a { + color: $accent-color; + cursor: pointer; + } } .mx_Dialog_buttons { diff --git a/src/components/views/settings/tabs/room/SecurityRoomSettingsTab.tsx b/src/components/views/settings/tabs/room/SecurityRoomSettingsTab.tsx index 4f036c5776..063e29751e 100644 --- a/src/components/views/settings/tabs/room/SecurityRoomSettingsTab.tsx +++ b/src/components/views/settings/tabs/room/SecurityRoomSettingsTab.tsx @@ -27,6 +27,8 @@ import SettingsStore from "../../../../../settings/SettingsStore"; import { UIFeature } from "../../../../../settings/UIFeature"; import { replaceableComponent } from "../../../../../utils/replaceableComponent"; import SettingsFlag from '../../../elements/SettingsFlag'; +import createRoom, { IOpts } from '../../../../../createRoom'; +import CreateRoomDialog from '../../../dialogs/CreateRoomDialog'; // Knock and private are reserved keywords which are not yet implemented. export enum JoinRule { @@ -124,7 +126,7 @@ export default class SecurityRoomSettingsTab extends React.Component { + private onEncryptionChange = async () => { if (this.state.joinRule == "public") { const { finished } = Modal.createTrackedDialog('Confirm Public Encrypted Room', '', QuestionDialog, { title: _t('Enable encryption in a public room?'), @@ -262,20 +264,47 @@ export default class SecurityRoomSettingsTab extends React.Component { + const modal = Modal.createTrackedDialog<[boolean, IOpts]>( + "Create Room", + "Create room after trying to make an E2EE room public", + CreateRoomDialog, + { defaultPublic }, + ); + const [shouldCreate, opts] = await modal.finished; + if (shouldCreate) { + await createRoom(opts); + } + return shouldCreate; + }; + private onRoomAccessRadioToggle = (roomAccess) => { if ( this.state.encrypted && this.state.joinRule != "public" && roomAccess != "invite_only" ) { - Modal.createTrackedDialog('Confirm Public Encrypted Room', '', QuestionDialog, { - title: _t('Confirm making this room public?'), - description: _t( - "Making end-to-end encrypted rooms public renders the " + - "encryption pointless, wastes processing power, and can cause " + - "performance problems. Please consider creating a separate " + - "unencrypted public room.", - ), + const dialog = Modal.createTrackedDialog('Confirm Public Encrypted Room', '', QuestionDialog, { + title: _t("Are you sure you want to make this encrypted room public?"), + description:
+

{ _t( + " It’s not recommended to make end-to-end encrypted rooms public. It " + + "means anyone can find and join this room, so anyone can read messages. You’ll " + + "get none of the benefits of encryption. Encrypting messages in a public room " + + "will also likely make receiving and sending messages slower than necessary.", + null, + { "b": (sub) => { sub } }, + )}

+

{ _t( + "To avoid these issues, create a new public room for the conversation " + + "you plan to have.", + null, + { "a": (sub) => { + dialog.close(); + this.createNewRoom(true); + }}> {sub} }, + )}

+
, onFinished: (confirm) => { if (confirm) this._setRoomAccess(roomAccess); }, diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 1dad3525e1..bfd257e0bb 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -1437,8 +1437,9 @@ "Note that enabling encryption in public rooms renders the encryption pointless, wastes processing power, and can cause performance problems. Please consider creating a separate encrypted room.": "Note that enabling encryption in public rooms renders the encryption pointless, wastes processing power, and can cause performance problems. Please consider creating a separate encrypted room.", "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 by the participants of the room. Enabling encryption may prevent many bots and bridges from working correctly. Learn more about encryption.": "Once enabled, encryption for a room cannot be disabled. Messages sent in an encrypted room cannot be seen by the server, only by the participants of the room. Enabling encryption may prevent many bots and bridges from working correctly. Learn more about encryption.", - "Confirm making this room public?": "Confirm making this room public?", - "Making end-to-end encrypted rooms public renders the encryption pointless, wastes processing power, and can cause performance problems. Please consider creating a separate unencrypted public room.": "Making end-to-end encrypted rooms public renders the encryption pointless, wastes processing power, and can cause performance problems. Please consider creating a separate unencrypted public room.", + "Are you sure you want to make this encrypted room public?": "Are you sure you want to make this encrypted room public?", + " It’s not recommended to make end-to-end encrypted rooms public. It means anyone can find and join this room, so anyone can read messages. You’ll get none of the benefits of encryption. Encrypting messages in a public room will also likely make receiving and sending messages slower than necessary.": " It’s not recommended to make end-to-end encrypted rooms public. It means anyone can find and join this room, so anyone can read messages. You’ll get none of the benefits of encryption. Encrypting messages in a public room will also likely make receiving and sending messages slower than necessary.", + "To avoid these issues, create a new public room for the conversation you plan to have.": "To avoid these issues, create a new public room for the conversation you plan to have.", "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", "To link to this room, please add an address.": "To link to this room, please add an address.",