Merge pull request #566 from matrix-org/rav/remove_dead_labs_settings

Get rid of always-on labs settings
This commit is contained in:
Richard van der Hoff 2016-11-21 10:38:06 +00:00 committed by GitHub
commit 06f12b91b8
4 changed files with 28 additions and 61 deletions

View file

@ -30,16 +30,6 @@ module.exports = {
id: 'rich_text_editor', id: 'rich_text_editor',
default: false, default: false,
}, },
{
name: 'End-to-End Encryption',
id: 'e2e_encryption',
default: true,
},
{
name: 'Integration Management',
id: 'integration_management',
default: true,
},
], ],
loadProfileInfo: function() { loadProfileInfo: function() {

View file

@ -27,7 +27,6 @@ var sdk = require('../../../index');
var ScalarAuthClient = require("../../../ScalarAuthClient"); var ScalarAuthClient = require("../../../ScalarAuthClient");
var Modal = require("../../../Modal"); var Modal = require("../../../Modal");
var SdkConfig = require('../../../SdkConfig'); var SdkConfig = require('../../../SdkConfig');
var UserSettingsStore = require('../../../UserSettingsStore');
linkifyMatrix(linkify); linkifyMatrix(linkify);
@ -213,16 +212,6 @@ module.exports = React.createClass({
// which requires the user to click through and THEN we can open the link in a new tab because // which requires the user to click through and THEN we can open the link in a new tab because
// the window.open command occurs in the same stack frame as the onClick callback. // the window.open command occurs in the same stack frame as the onClick callback.
let integrationsEnabled = UserSettingsStore.isFeatureEnabled("integration_management");
if (!integrationsEnabled) {
var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
Modal.createDialog(ErrorDialog, {
title: "Integrations disabled",
description: "You need to enable the Labs option 'Integrations Management' in your Riot user settings first.",
});
return;
}
// Go fetch a scalar token // Go fetch a scalar token
let scalarClient = new ScalarAuthClient(); let scalarClient = new ScalarAuthClient();
scalarClient.connect().then(() => { scalarClient.connect().then(() => {
@ -304,4 +293,3 @@ module.exports = React.createClass({
} }
}, },
}); });

View file

@ -30,7 +30,6 @@ var classNames = require('classnames');
var dis = require("../../../dispatcher"); var dis = require("../../../dispatcher");
var Modal = require("../../../Modal"); var Modal = require("../../../Modal");
var sdk = require('../../../index'); var sdk = require('../../../index');
var UserSettingsStore = require('../../../UserSettingsStore');
var createRoom = require('../../../createRoom'); var createRoom = require('../../../createRoom');
var DMRoomMap = require('../../../utils/DMRoomMap'); var DMRoomMap = require('../../../utils/DMRoomMap');
var Unread = require('../../../Unread'); var Unread = require('../../../Unread');
@ -71,10 +70,8 @@ module.exports = WithMatrixClient(React.createClass({
componentWillMount: function() { componentWillMount: function() {
this._cancelDeviceList = null; this._cancelDeviceList = null;
// only display the devices list if our client supports E2E *and* the // only display the devices list if our client supports E2E
// feature is enabled in the user settings this._enableDevices = this.props.matrixClient.isCryptoEnabled();
this._enableDevices = this.props.matrixClient.isCryptoEnabled() &&
UserSettingsStore.isFeatureEnabled("e2e_encryption");
const cli = this.props.matrixClient; const cli = this.props.matrixClient;
cli.on("deviceVerificationChanged", this.onDeviceVerificationChanged); cli.on("deviceVerificationChanged", this.onDeviceVerificationChanged);

View file

@ -24,7 +24,6 @@ var ObjectUtils = require("../../../ObjectUtils");
var dis = require("../../../dispatcher"); var dis = require("../../../dispatcher");
var ScalarAuthClient = require("../../../ScalarAuthClient"); var ScalarAuthClient = require("../../../ScalarAuthClient");
var ScalarMessaging = require('../../../ScalarMessaging'); var ScalarMessaging = require('../../../ScalarMessaging');
var UserSettingsStore = require('../../../UserSettingsStore');
// parse a string as an integer; if the input is undefined, or cannot be parsed // parse a string as an integer; if the input is undefined, or cannot be parsed
// as an integer, return a default. // as an integer, return a default.
@ -81,16 +80,14 @@ module.exports = React.createClass({
console.error("Failed to get room visibility: " + err); console.error("Failed to get room visibility: " + err);
}); });
if (UserSettingsStore.isFeatureEnabled("integration_management")) { this.scalarClient = new ScalarAuthClient();
this.scalarClient = new ScalarAuthClient(); this.scalarClient.connect().done(() => {
this.scalarClient.connect().done(() => { this.forceUpdate();
this.forceUpdate(); }, (err) => {
}, (err) => { this.setState({
this.setState({ scalar_error: err
scalar_error: err });
}); });
})
}
dis.dispatch({ dis.dispatch({
action: 'ui_opacity', action: 'ui_opacity',
@ -477,10 +474,6 @@ module.exports = React.createClass({
}, },
_renderEncryptionSection: function() { _renderEncryptionSection: function() {
if (!UserSettingsStore.isFeatureEnabled("e2e_encryption")) {
return null;
}
var cli = MatrixClientPeg.get(); var cli = MatrixClientPeg.get();
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);
@ -684,27 +677,26 @@ module.exports = React.createClass({
</span> </span>
); );
} }
if (UserSettingsStore.isFeatureEnabled("integration_management")) {
if (this.scalarClient.hasCredentials()) { if (this.scalarClient.hasCredentials()) {
integrationsButton = ( integrationsButton = (
<div className="mx_RoomSettings_integrationsButton" onClick={ this.onManageIntegrations }> <div className="mx_RoomSettings_integrationsButton" onClick={ this.onManageIntegrations }>
Manage Integrations Manage Integrations
</div> </div>
); );
} else if (this.state.scalar_error) { } else if (this.state.scalar_error) {
integrationsButton = ( integrationsButton = (
<div className="mx_RoomSettings_integrationsButton_error" onClick={ this.onShowIntegrationsError }> <div className="mx_RoomSettings_integrationsButton_error" onClick={ this.onShowIntegrationsError }>
Integrations Error <img src="img/warning.svg" width="17"/> Integrations Error <img src="img/warning.svg" width="17"/>
{ integrationsError } { integrationsError }
</div> </div>
); );
} else { } else {
integrationsButton = ( integrationsButton = (
<div className="mx_RoomSettings_integrationsButton" style={{ opacity: 0.5 }}> <div className="mx_RoomSettings_integrationsButton" style={{ opacity: 0.5 }}>
Manage Integrations Manage Integrations
</div> </div>
); );
}
} }
return ( return (