mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-17 14:05:04 +08:00
improve e2e and scalar settings UI
This commit is contained in:
parent
0473b14564
commit
2752d6b444
@ -430,6 +430,27 @@ module.exports = React.createClass({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onEnableEncryptionClick() {
|
||||||
|
var QuestionDialog = sdk.getComponent("dialogs.QuestionDialog");
|
||||||
|
Modal.createDialog(QuestionDialog, {
|
||||||
|
title: "Warning!",
|
||||||
|
description: (
|
||||||
|
<div>
|
||||||
|
<p>End-to-end encryption is in beta and may not be reliable.</p>
|
||||||
|
<p>You should <b>not</b> yet trust it to secure data.</p>
|
||||||
|
<p>Once encryption is enabled for a room it <b>cannot</b> be turned off again (for now).</p>
|
||||||
|
<p>Encrypted messages will not be visible on clients that do not yet implement encryption<br/>
|
||||||
|
(e.g. Vector/iOS and Vector/Android).</p>
|
||||||
|
</div>
|
||||||
|
),
|
||||||
|
onFinished: confirm=>{
|
||||||
|
if (!confirm) {
|
||||||
|
this.refs.encrypt.checked = false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
_renderEncryptionSection: function() {
|
_renderEncryptionSection: function() {
|
||||||
if (!UserSettingsStore.isFeatureEnabled("e2e_encryption")) {
|
if (!UserSettingsStore.isFeatureEnabled("e2e_encryption")) {
|
||||||
return null;
|
return null;
|
||||||
@ -439,27 +460,27 @@ module.exports = React.createClass({
|
|||||||
var roomState = this.props.room.currentState;
|
var roomState = this.props.room.currentState;
|
||||||
var isEncrypted = cli.isRoomEncrypted(this.props.room.roomId);
|
var isEncrypted = cli.isRoomEncrypted(this.props.room.roomId);
|
||||||
|
|
||||||
var text = "Encryption is " + (isEncrypted ? "" : "not ") +
|
|
||||||
"enabled in this room.";
|
|
||||||
|
|
||||||
var button;
|
|
||||||
if (!isEncrypted &&
|
if (!isEncrypted &&
|
||||||
roomState.mayClientSendStateEvent("m.room.encryption", cli)) {
|
roomState.mayClientSendStateEvent("m.room.encryption", cli)) {
|
||||||
button = (
|
return (
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" ref="encrypt" />
|
<input type="checkbox" ref="encrypt" onClick={ this.onEnableEncryptionClick }/>
|
||||||
|
<img className="mx_RoomSettings_e2eIcon" src="img/e2e-unencrypted.svg" width="12" height="12" />
|
||||||
Enable encryption (warning: cannot be disabled again!)
|
Enable encryption (warning: cannot be disabled again!)
|
||||||
</label>
|
</label>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
return (
|
return (
|
||||||
<div className="mx_RoomSettings_toggles">
|
<label>
|
||||||
<h3>Encryption</h3>
|
{ isEncrypted
|
||||||
<label>{text}</label>
|
? <img className="mx_RoomSettings_e2eIcon" src="img/e2e-verified.svg" width="10" height="12" />
|
||||||
{button}
|
: <img className="mx_RoomSettings_e2eIcon" src="img/e2e-unencrypted.svg" width="12" height="12" />
|
||||||
</div>
|
}
|
||||||
);
|
Encryption is { isEncrypted ? "" : "not " } enabled in this room.
|
||||||
|
</label>
|
||||||
|
);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
render: function() {
|
render: function() {
|
||||||
@ -628,33 +649,30 @@ module.exports = React.createClass({
|
|||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
var integrations_section;
|
var integrationsButton;
|
||||||
if (UserSettingsStore.isFeatureEnabled("integration_management")) {
|
if (UserSettingsStore.isFeatureEnabled("integration_management")) {
|
||||||
let integrations_body;
|
|
||||||
|
|
||||||
if (this.scalarClient.hasCredentials()) {
|
if (this.scalarClient.hasCredentials()) {
|
||||||
integrations_body = (
|
integrationsButton = (
|
||||||
<div className="mx_RoomSettings_settings">
|
<div className="mx_RoomSettings_integrationsButton" onClick={ this.onManageIntegrations }>
|
||||||
<a href="#" onClick={ this.onManageIntegrations }>Manage integrations</a>
|
Manage Integrations
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
} else if (this.state.scalar_error) {
|
} else if (this.state.scalar_error) {
|
||||||
integrations_body = <div className="error">
|
console.error("Unable to contact integrations server");
|
||||||
Unable to contact integrations server
|
|
||||||
</div>;
|
|
||||||
} else {
|
} else {
|
||||||
integrations_body = <Loader />;
|
integrationsButton = (
|
||||||
|
<div className="mx_RoomSettings_integrationsButton" onClick={ this.onManageIntegrations }>
|
||||||
|
<Loader />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
integrations_section = <div>
|
|
||||||
<h3>Integrations</h3>
|
|
||||||
{integrations_body}
|
|
||||||
</div>;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="mx_RoomSettings">
|
<div className="mx_RoomSettings">
|
||||||
|
|
||||||
{ leaveButton }
|
{ leaveButton }
|
||||||
|
{ integrationsButton }
|
||||||
|
|
||||||
{ tagsSection }
|
{ tagsSection }
|
||||||
|
|
||||||
@ -685,6 +703,7 @@ module.exports = React.createClass({
|
|||||||
</label>
|
</label>
|
||||||
{ addressWarning }
|
{ addressWarning }
|
||||||
<br/>
|
<br/>
|
||||||
|
{ this._renderEncryptionSection() }
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" disabled={ !roomState.mayClientSendStateEvent("m.room.aliases", cli) }
|
<input type="checkbox" disabled={ !roomState.mayClientSendStateEvent("m.room.aliases", cli) }
|
||||||
onChange={ this._onToggle.bind(this, "isRoomPublished", true, false)}
|
onChange={ this._onToggle.bind(this, "isRoomPublished", true, false)}
|
||||||
@ -731,8 +750,6 @@ module.exports = React.createClass({
|
|||||||
<ColorSettings ref="color_settings" room={this.props.room} />
|
<ColorSettings ref="color_settings" room={this.props.room} />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{ integrations_section }
|
|
||||||
|
|
||||||
<a id="addresses"/>
|
<a id="addresses"/>
|
||||||
|
|
||||||
<AliasSettings ref="alias_settings"
|
<AliasSettings ref="alias_settings"
|
||||||
@ -791,8 +808,6 @@ module.exports = React.createClass({
|
|||||||
|
|
||||||
{ bannedUsersSection }
|
{ bannedUsersSection }
|
||||||
|
|
||||||
{ this._renderEncryptionSection() }
|
|
||||||
|
|
||||||
<h3>Advanced</h3>
|
<h3>Advanced</h3>
|
||||||
<div className="mx_RoomSettings_settings">
|
<div className="mx_RoomSettings_settings">
|
||||||
This room's internal ID is <code>{ this.props.room.roomId }</code>
|
This room's internal ID is <code>{ this.props.room.roomId }</code>
|
||||||
|
Loading…
Reference in New Issue
Block a user