hide room settings when you launch scalar if you haven't made changes

pull/21833/head
Matthew Hodgson 2016-09-15 00:43:30 +01:00
parent 1a126fee54
commit 499783d697
1 changed files with 21 additions and 8 deletions

View File

@ -132,11 +132,11 @@ module.exports = React.createClass({
}); });
return stateWasSetDefer.promise.then(() => { return stateWasSetDefer.promise.then(() => {
return this._save(); return q.allSettled(this._calcSavePromises());
}); });
}, },
_save: function() { _calcSavePromises: function() {
const roomId = this.props.room.roomId; const roomId = this.props.room.roomId;
var promises = this.saveAliases(); // returns Promise[] var promises = this.saveAliases(); // returns Promise[]
var originalState = this.getInitialState(); var originalState = this.getInitialState();
@ -217,16 +217,26 @@ module.exports = React.createClass({
} }
// color scheme // color scheme
promises.push(this.saveColor()); var p;
p = this.saveColor();
if (!q.isFulfilled(p)) {
promises.push(p);
}
// url preview settings // url preview settings
promises.push(this.saveUrlPreviewSettings()); var ps = this.saveUrlPreviewSettings();
if (ps.length > 0) {
promises.push();
}
// encryption // encryption
promises.push(this.saveEncryption()); p = this.saveEncryption();
if (!q.isFulfilled(p)) {
promises.push(p);
}
console.log("Performing %s operations: %s", promises.length, JSON.stringify(promises)); console.log("Performing %s operations: %s", promises.length, JSON.stringify(promises));
return q.allSettled(promises); return promises;
}, },
saveAliases: function() { saveAliases: function() {
@ -402,6 +412,9 @@ module.exports = React.createClass({
onManageIntegrations(ev) { onManageIntegrations(ev) {
ev.preventDefault(); ev.preventDefault();
var IntegrationsManager = sdk.getComponent("views.settings.IntegrationsManager"); var IntegrationsManager = sdk.getComponent("views.settings.IntegrationsManager");
if (this._calcSavePromises().length === 0) {
this.props.onCancelClick(ev);
}
Modal.createDialog(IntegrationsManager, { Modal.createDialog(IntegrationsManager, {
src: this.scalarClient.hasCredentials() ? src: this.scalarClient.hasCredentials() ?
this.scalarClient.getScalarInterfaceUrlForRoom(this.props.room.roomId) : this.scalarClient.getScalarInterfaceUrlForRoom(this.props.room.roomId) :
@ -661,8 +674,8 @@ module.exports = React.createClass({
console.error("Unable to contact integrations server"); console.error("Unable to contact integrations server");
} else { } else {
integrationsButton = ( integrationsButton = (
<div className="mx_RoomSettings_integrationsButton" onClick={ this.onManageIntegrations }> <div className="mx_RoomSettings_integrationsButton" style={{ opacity: 0.5 }}>
<Loader /> Manage Integrations
</div> </div>
); );
} }