Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit d7acaa9

Browse files
committed
Update onEncryptionChange dialog
Signed-off-by: Šimon Brandner <[email protected]>
1 parent 0e4ea97 commit d7acaa9

File tree

2 files changed

+32
-13
lines changed

2 files changed

+32
-13
lines changed

src/components/views/settings/tabs/room/SecurityRoomSettingsTab.tsx

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -128,16 +128,34 @@ export default class SecurityRoomSettingsTab extends React.Component<IProps, ISt
128128

129129
private onEncryptionChange = async () => {
130130
if (this.state.joinRule == "public") {
131-
const { finished } = Modal.createTrackedDialog('Confirm Public Encrypted Room', '', QuestionDialog, {
132-
title: _t('Enable encryption in a public room?'),
133-
description: _t(
134-
"Note that enabling encryption in public rooms renders the " +
135-
"encryption pointless, wastes processing power, and can cause " +
136-
"performance problems. Please consider creating a separate " +
137-
"encrypted room.",
138-
),
131+
const dialog = Modal.createTrackedDialog('Confirm Public Encrypted Room', '', QuestionDialog, {
132+
title: _t('Are you sure you want to add encryption to this public room?'),
133+
description: <div>
134+
<p> { _t(
135+
"<b> It’s not recommended to turn on encryption on for public rooms. </b>" +
136+
"Anyone can find and join public rooms, so anyone can read messages. You’ll " +
137+
"get none of the benefits of encryption, and you won't be able to turn it " +
138+
"off later. Encrypting messages in a public room will also likely make " +
139+
"receiving and sending messages slower than necessary.",
140+
null,
141+
{ "b": (sub) => <b> { sub } </b> },
142+
)} </p>
143+
<p> { _t(
144+
"To avoid these issues, create a <a> new private encrypted room </a> for " +
145+
"the conversation you plan to have.",
146+
null,
147+
{ "a": (sub) => <a onClick={() => {
148+
dialog.close();
149+
this.createNewRoom(false, true);
150+
}}> {sub} </a> },
151+
)} </p>
152+
</div>,
153+
139154
});
155+
156+
const { finished } = dialog;
140157
const [confirm] = await finished;
158+
141159
if (!confirm) {
142160
this.setState({ encrypted: false });
143161
return;
@@ -264,12 +282,12 @@ export default class SecurityRoomSettingsTab extends React.Component<IProps, ISt
264282
});
265283
};
266284

267-
private createNewRoom = async (defaultPublic: boolean) => {
285+
private createNewRoom = async (defaultPublic: boolean, defaultEncrypted: boolean) => {
268286
const modal = Modal.createTrackedDialog<[boolean, IOpts]>(
269287
"Create Room",
270288
"Create room after trying to make an E2EE room public",
271289
CreateRoomDialog,
272-
{ defaultPublic },
290+
{ defaultPublic, defaultEncrypted },
273291
);
274292
const [shouldCreate, opts] = await modal.finished;
275293
if (shouldCreate) {
@@ -301,7 +319,7 @@ export default class SecurityRoomSettingsTab extends React.Component<IProps, ISt
301319
null,
302320
{ "a": (sub) => <a onClick={() => {
303321
dialog.close();
304-
this.createNewRoom(true);
322+
this.createNewRoom(true, false);
305323
}}> {sub} </a> },
306324
)} </p>
307325
</div>,

src/i18n/strings/en_EN.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1433,8 +1433,9 @@
14331433
"Roles & Permissions": "Roles & Permissions",
14341434
"Permissions": "Permissions",
14351435
"Select the roles required to change various parts of the room": "Select the roles required to change various parts of the room",
1436-
"Enable encryption in a public room?": "Enable encryption in a public room?",
1437-
"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.",
1436+
"Are you sure you want to add encryption to this public room?": "Are you sure you want to add encryption to this public room?",
1437+
"<b> It’s not recommended to turn on encryption on for public rooms. </b>Anyone can find and join public rooms, so anyone can read messages. You’ll get none of the benefits of encryption, and you won't be able to turn it off later. Encrypting messages in a public room will also likely make receiving and sending messages slower than necessary.": "<b> It’s not recommended to turn on encryption on for public rooms. </b>Anyone can find and join public rooms, so anyone can read messages. You’ll get none of the benefits of encryption, and you won't be able to turn it off later. Encrypting messages in a public room will also likely make receiving and sending messages slower than necessary.",
1438+
"To avoid these issues, create a <a> new private encrypted room </a> for the conversation you plan to have.": "To avoid these issues, create a <a> new private encrypted room </a> for the conversation you plan to have.",
14381439
"Enable encryption?": "Enable encryption?",
14391440
"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. <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 by the participants of the room. Enabling encryption may prevent many bots and bridges from working correctly. <a>Learn more about encryption.</a>",
14401441
"Are you sure you want to make this encrypted room public?": "Are you sure you want to make this encrypted room public?",

0 commit comments

Comments
 (0)