From ada860f163b66a54c0518cb5a21b547b472b5934 Mon Sep 17 00:00:00 2001
From: Michael Telatynski <7t3chguy@gmail.com>
Date: Wed, 8 Apr 2020 10:50:22 +0100
Subject: [PATCH 1/4] Add toggle for e2ee when creating private room in
x-signing world
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
---
res/css/views/dialogs/_CreateRoomDialog.scss | 1 +
.../views/dialogs/CreateRoomDialog.js | 20 +++++++++++++++++++
src/i18n/strings/en_EN.json | 2 ++
3 files changed, 23 insertions(+)
diff --git a/res/css/views/dialogs/_CreateRoomDialog.scss b/res/css/views/dialogs/_CreateRoomDialog.scss
index c542741c30..ac46b8e91a 100644
--- a/res/css/views/dialogs/_CreateRoomDialog.scss
+++ b/res/css/views/dialogs/_CreateRoomDialog.scss
@@ -78,6 +78,7 @@ limitations under the License.
.mx_SettingsFlag {
display: flex;
+ margin-top: 4px;
}
.mx_SettingsFlag_label {
diff --git a/src/components/views/dialogs/CreateRoomDialog.js b/src/components/views/dialogs/CreateRoomDialog.js
index 77014db21d..2431a4d32f 100644
--- a/src/components/views/dialogs/CreateRoomDialog.js
+++ b/src/components/views/dialogs/CreateRoomDialog.js
@@ -24,6 +24,7 @@ import withValidation from '../elements/Validation';
import { _t } from '../../../languageHandler';
import {MatrixClientPeg} from '../../../MatrixClientPeg';
import {Key} from "../../../Keyboard";
+import SettingsStore from "../../../settings/SettingsStore";
export default createReactClass({
displayName: 'CreateRoomDialog',
@@ -35,6 +36,7 @@ export default createReactClass({
const config = SdkConfig.get();
return {
isPublic: false,
+ isEncrypted: true,
name: "",
topic: "",
alias: "",
@@ -62,6 +64,11 @@ export default createReactClass({
if (this.state.noFederate) {
createOpts.creation_content = {'m.federate': false};
}
+
+ if (!this.state.isPublic && SettingsStore.isFeatureEnabled("feature_cross_signing")) {
+ createOpts.encryption = this.state.isEncrypted;
+ }
+
return opts;
},
@@ -127,6 +134,10 @@ export default createReactClass({
this.setState({isPublic});
},
+ onEncryptedChange(isEncrypted) {
+ this.setState({isEncrypted});
+ },
+
onAliasChange(alias) {
this.setState({alias});
},
@@ -181,6 +192,14 @@ export default createReactClass({
privateLabel = (
{_t("This room is private, and can only be joined by invitation.")}
);
}
+ let e2eeSection;
+ if (!this.state.isPublic && SettingsStore.isFeatureEnabled("feature_cross_signing")) {
+ e2eeSection =
+
+ { _t("Bridges and most bots will not function in end-to-end encrypted rooms.") }
+ ;
+ }
+
const title = this.state.isPublic ? _t('Create a public room') : _t('Create a private room');
return (
this._nameFieldRef = ref} label={ _t('Name') } onChange={this.onNameChange} onValidate={this.onNameValidate} value={this.state.name} className="mx_CreateRoomDialog_name" />
+ { e2eeSection }
{ privateLabel }
{ publicLabel }
{ aliasField }
diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json
index aa2f0aa819..2e33445821 100644
--- a/src/i18n/strings/en_EN.json
+++ b/src/i18n/strings/en_EN.json
@@ -1555,6 +1555,8 @@
"Please enter a name for the room": "Please enter a name for the room",
"Set a room alias to easily share your room with other people.": "Set a room alias to easily share your room with other people.",
"This room is private, and can only be joined by invitation.": "This room is private, and can only be joined by invitation.",
+ "Enable end-to-end encryption": "Enable end-to-end encryption",
+ "Bridges and most bots will not function in end-to-end encrypted rooms.": "Bridges and most bots will not function in end-to-end encrypted rooms.",
"Create a public room": "Create a public room",
"Create a private room": "Create a private room",
"Name": "Name",
From eec28ce38ad504c3b27555a256e578a2d527f12d Mon Sep 17 00:00:00 2001
From: Michael Telatynski <7t3chguy@gmail.com>
Date: Wed, 8 Apr 2020 13:47:15 +0100
Subject: [PATCH 2/4] Update styling and copy to match Figma
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
---
res/css/views/dialogs/_CreateRoomDialog.scss | 22 +++++++++++++++++--
.../views/dialogs/CreateRoomDialog.js | 14 +++++-------
src/i18n/strings/en_EN.json | 2 +-
3 files changed, 27 insertions(+), 11 deletions(-)
diff --git a/res/css/views/dialogs/_CreateRoomDialog.scss b/res/css/views/dialogs/_CreateRoomDialog.scss
index ac46b8e91a..6800722802 100644
--- a/res/css/views/dialogs/_CreateRoomDialog.scss
+++ b/res/css/views/dialogs/_CreateRoomDialog.scss
@@ -15,6 +15,8 @@ limitations under the License.
*/
.mx_CreateRoomDialog_details {
+ margin-top: 15px;
+
.mx_CreateRoomDialog_details_summary {
outline: none;
list-style: none;
@@ -71,14 +73,17 @@ limitations under the License.
}
.mx_CreateRoomDialog {
-
&.mx_Dialog_fixedWidth {
width: 450px;
}
+ p,
+ .mx_Field_input label {
+ color: $muted-fg-color;
+ }
+
.mx_SettingsFlag {
display: flex;
- margin-top: 4px;
}
.mx_SettingsFlag_label {
@@ -91,5 +96,18 @@ limitations under the License.
flex: 0 0 auto;
margin-left: 30px;
}
+
+ .mx_CreateRoomDialog_topic {
+ margin-bottom: 36px;
+ }
+
+ .mx_Dialog_content > .mx_SettingsFlag {
+ margin-top: 20px;
+ }
+
+ p {
+ margin: 0 85px 0 0;
+ line-height: $font-24px;
+ }
}
diff --git a/src/components/views/dialogs/CreateRoomDialog.js b/src/components/views/dialogs/CreateRoomDialog.js
index 2431a4d32f..5f723234b0 100644
--- a/src/components/views/dialogs/CreateRoomDialog.js
+++ b/src/components/views/dialogs/CreateRoomDialog.js
@@ -177,11 +177,10 @@ export default createReactClass({
const LabelledToggleSwitch = sdk.getComponent('views.elements.LabelledToggleSwitch');
const RoomAliasField = sdk.getComponent('views.elements.RoomAliasField');
- let privateLabel;
- let publicLabel;
+ let publicPrivateLabel;
let aliasField;
if (this.state.isPublic) {
- publicLabel = ({_t("Set a room alias to easily share your room with other people.")}
);
+ publicPrivateLabel = ({_t("Set a room alias to easily share your room with other people.")}
);
const domain = MatrixClientPeg.get().getDomain();
aliasField = (
@@ -189,14 +188,14 @@ export default createReactClass({
);
} else {
- privateLabel = ({_t("This room is private, and can only be joined by invitation.")}
);
+ publicPrivateLabel = ({_t("This room is private, and can only be joined by invitation.")}
);
}
let e2eeSection;
if (!this.state.isPublic && SettingsStore.isFeatureEnabled("feature_cross_signing")) {
e2eeSection =
- { _t("Bridges and most bots will not function in end-to-end encrypted rooms.") }
+ { _t("You can’t disable this later. Bridges & most bots currently won’t work.") }
;
}
@@ -208,11 +207,10 @@ export default createReactClass({