diff --git a/src/components/views/settings/Notifications.js b/src/components/views/settings/Notifications.js index e0cfd159..7ca3fa3a 100644 --- a/src/components/views/settings/Notifications.js +++ b/src/components/views/settings/Notifications.js @@ -103,6 +103,7 @@ module.exports = React.createClass({ }, onNotifStateButtonClicked: function(event) { + // FIXME: use .bind() rather than className metadata here surely var vectorRuleId = event.target.className.split("-")[0]; var newPushRuleVectorState = event.target.className.split("-")[1]; @@ -410,7 +411,9 @@ module.exports = React.createClass({ _refreshFromServer: function() { var self = this; - var pushRulesPromise = MatrixClientPeg.get().getPushRules().then(self._portRulesToNewAPI).done(function(rulesets) { + var pushRulesPromise = MatrixClientPeg.get().getPushRules().then(self._portRulesToNewAPI).then(function(rulesets) { + //console.log("resolving pushRulesPromise"); + /// XXX seriously? wtf is this? MatrixClientPeg.get().pushRules = rulesets; @@ -501,6 +504,8 @@ module.exports = React.createClass({ var vectorState = ruleDefinition.ruleToVectorState(rule); + //console.log("Refreshing vectorPushRules for " + vectorRuleId +", "+ ruleDefinition.description +", " + rule +", " + vectorState); + self.state.vectorPushRules.push({ "vectorRuleId": vectorRuleId, "description" : ruleDefinition.description, @@ -535,10 +540,11 @@ module.exports = React.createClass({ }); var pushersPromise = MatrixClientPeg.get().getPushers().then(function(resp) { + //console.log("resolving pushersPromise"); self.setState({pushers: resp.pushers}); }); - q.all([pushRulesPromise, pushersPromise]).done(function() { + q.all([pushRulesPromise, pushersPromise]).then(function() { self.setState({ phase: self.phases.DISPLAY }); @@ -546,6 +552,15 @@ module.exports = React.createClass({ self.setState({ phase: self.phases.ERROR }); + }).finally(() => { + // actually explicitly update our state having been deep-manipulating it + self.state({ + masterPushRule: self.state.masterPushRule, + vectorContentRules: self.state.vectorContentRules, + vectorPushRules: self.state.vectorPushRules, + externalContentRules: self.state.externalContentRules, + externalPushRules: self.state.externalPushRules, + }); }); }, @@ -599,6 +614,7 @@ module.exports = React.createClass({ var rows = []; for (var i in this.state.vectorPushRules) { var rule = this.state.vectorPushRules[i]; + //console.log("rendering: " + rule.description + ", " + rule.vectorRuleId + ", " + rule.vectorState); rows.push(this.renderNotifRulesTableRow(rule.description, rule.vectorRuleId, rule.vectorState)); } return rows; @@ -607,13 +623,10 @@ module.exports = React.createClass({ render: function() { var self = this; + var spinner; if (this.state.phase === this.phases.LOADING) { var Loader = sdk.getComponent("elements.Spinner"); - return ( -
- -
- ); + spinner = ; } if (this.state.masterPushRule) { @@ -714,6 +727,8 @@ module.exports = React.createClass({
+ { spinner } +
Off On - Loud + Highlight
& sound diff --git a/src/skins/vector/css/matrix-react-sdk/structures/UserSettings.css b/src/skins/vector/css/matrix-react-sdk/structures/UserSettings.css index 6ef69f1d..2ab1f5eb 100644 --- a/src/skins/vector/css/matrix-react-sdk/structures/UserSettings.css +++ b/src/skins/vector/css/matrix-react-sdk/structures/UserSettings.css @@ -106,6 +106,10 @@ limitations under the License. display: table; } +.mx_UserSettings_notifTable .mx_Spinner { + position: absolute; +} + .mx_UserSettings_profileTable { display: table;