Disable the e2ee toggle when creating a room on a server with forced e2e
Fixes https://github.com/vector-im/element-web/issues/15186 Requires https://github.com/matrix-org/matrix-js-sdk/pull/1470
This commit is contained in:
parent
d59a1fbd80
commit
38f8c0a835
2 changed files with 18 additions and 2 deletions
|
@ -45,7 +45,11 @@ export default class CreateRoomDialog extends React.Component {
|
||||||
detailsOpen: false,
|
detailsOpen: false,
|
||||||
noFederate: config.default_federate === false,
|
noFederate: config.default_federate === false,
|
||||||
nameIsValid: false,
|
nameIsValid: false,
|
||||||
|
canChangeEncryption: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
MatrixClientPeg.get().doesServerForceEncryptionForPreset("private")
|
||||||
|
.then(isForced => this.setState({canChangeEncryption: !isForced}));
|
||||||
}
|
}
|
||||||
|
|
||||||
_roomCreateOptions() {
|
_roomCreateOptions() {
|
||||||
|
@ -68,7 +72,13 @@ export default class CreateRoomDialog extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.state.isPublic) {
|
if (!this.state.isPublic) {
|
||||||
opts.encryption = this.state.isEncrypted;
|
if (this.state.canChangeEncryption) {
|
||||||
|
opts.encryption = this.state.isEncrypted;
|
||||||
|
} else {
|
||||||
|
// the server should automatically do this for us, but for safety
|
||||||
|
// we'll demand it too.
|
||||||
|
opts.encryption = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CommunityPrototypeStore.instance.getSelectedCommunityId()) {
|
if (CommunityPrototypeStore.instance.getSelectedCommunityId()) {
|
||||||
|
@ -208,7 +218,11 @@ export default class CreateRoomDialog extends React.Component {
|
||||||
if (!this.state.isPublic) {
|
if (!this.state.isPublic) {
|
||||||
let microcopy;
|
let microcopy;
|
||||||
if (privateShouldBeEncrypted()) {
|
if (privateShouldBeEncrypted()) {
|
||||||
microcopy = _t("You can’t disable this later. Bridges & most bots won’t work yet.");
|
if (this.state.canChangeEncryption) {
|
||||||
|
microcopy = _t("You can’t disable this later. Bridges & most bots won’t work yet.");
|
||||||
|
} else {
|
||||||
|
microcopy = _t("Your server requires encryption to be enabled in private rooms.");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
microcopy = _t("Your server admin has disabled end-to-end encryption by default " +
|
microcopy = _t("Your server admin has disabled end-to-end encryption by default " +
|
||||||
"in private rooms & Direct Messages.");
|
"in private rooms & Direct Messages.");
|
||||||
|
@ -219,6 +233,7 @@ export default class CreateRoomDialog extends React.Component {
|
||||||
onChange={this.onEncryptedChange}
|
onChange={this.onEncryptedChange}
|
||||||
value={this.state.isEncrypted}
|
value={this.state.isEncrypted}
|
||||||
className='mx_CreateRoomDialog_e2eSwitch' // for end-to-end tests
|
className='mx_CreateRoomDialog_e2eSwitch' // for end-to-end tests
|
||||||
|
disabled={!this.state.canChangeEncryption}
|
||||||
/>
|
/>
|
||||||
<p>{ microcopy }</p>
|
<p>{ microcopy }</p>
|
||||||
</React.Fragment>;
|
</React.Fragment>;
|
||||||
|
|
|
@ -1659,6 +1659,7 @@
|
||||||
"Private rooms can be found and joined by invitation only. Public rooms can be found and joined by anyone.": "Private rooms can be found and joined by invitation only. Public rooms can be found and joined by anyone.",
|
"Private rooms can be found and joined by invitation only. Public rooms can be found and joined by anyone.": "Private rooms can be found and joined by invitation only. Public rooms can be found and joined by anyone.",
|
||||||
"Private rooms can be found and joined by invitation only. Public rooms can be found and joined by anyone in this community.": "Private rooms can be found and joined by invitation only. Public rooms can be found and joined by anyone in this community.",
|
"Private rooms can be found and joined by invitation only. Public rooms can be found and joined by anyone in this community.": "Private rooms can be found and joined by invitation only. Public rooms can be found and joined by anyone in this community.",
|
||||||
"You can’t disable this later. Bridges & most bots won’t work yet.": "You can’t disable this later. Bridges & most bots won’t work yet.",
|
"You can’t disable this later. Bridges & most bots won’t work yet.": "You can’t disable this later. Bridges & most bots won’t work yet.",
|
||||||
|
"Your server requires encryption to be enabled in private rooms.": "Your server requires encryption to be enabled in private rooms.",
|
||||||
"Enable end-to-end encryption": "Enable end-to-end encryption",
|
"Enable end-to-end encryption": "Enable end-to-end encryption",
|
||||||
"You might enable this if the room will only be used for collaborating with internal teams on your homeserver. This cannot be changed later.": "You might enable this if the room will only be used for collaborating with internal teams on your homeserver. This cannot be changed later.",
|
"You might enable this if the room will only be used for collaborating with internal teams on your homeserver. This cannot be changed later.": "You might enable this if the room will only be used for collaborating with internal teams on your homeserver. This cannot be changed later.",
|
||||||
"You might disable this if the room will be used for collaborating with external teams who have their own homeserver. This cannot be changed later.": "You might disable this if the room will be used for collaborating with external teams who have their own homeserver. This cannot be changed later.",
|
"You might disable this if the room will be used for collaborating with external teams who have their own homeserver. This cannot be changed later.": "You might disable this if the room will be used for collaborating with external teams who have their own homeserver. This cannot be changed later.",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue