diff --git a/src/components/views/settings/Notifications.js b/src/components/views/settings/Notifications.js index db066774c5..749bc9ae7a 100644 --- a/src/components/views/settings/Notifications.js +++ b/src/components/views/settings/Notifications.js @@ -601,7 +601,7 @@ module.exports = React.createClass({ _refreshFromServer: function() { var self = this; - MatrixClientPeg.get().getPushRules().then(self._portRulesToNewAPI).done(function(rulesets) { + var pushRulesPromise = MatrixClientPeg.get().getPushRules().then(self._portRulesToNewAPI).done(function(rulesets) { MatrixClientPeg.get().pushRules = rulesets; // Get homeserver default rules and triage them by categories @@ -811,10 +811,20 @@ module.exports = React.createClass({ self.state.externalPushRules.push(rule); } } + }); + var pushersPromise = MatrixClientPeg.get().getPushers().then(function(resp) { + self.setState({pushers: resp.pushers}); + }); + + q.all([pushRulesPromise, pushersPromise]).done(function() { self.setState({ phase: self.phases.DISPLAY }); + }, function(error) { + self.setState({ + phase: self.phases.ERROR + }); }); }, @@ -936,6 +946,32 @@ module.exports = React.createClass({ externalRules.push(
  • Notifications on the following keywords follow rules which can’t be displayed here: { externalKeyWords }
  • ); } + var devicesSection; + if (this.state.pushers === undefined) { + devicesSection =
    Unable to fetch device list
    + } else if (this.state.pushers.length == 0) { + devicesSection =
    + No devices are receiving push notifications +
    + } else { + // It would be great to be able to delete pushers from here too, + // and this wouldn't be hard to add. + var rows = []; + for (var i = 0; i < this.state.pushers.length; ++i) { + rows.push( + {this.state.pushers[i].app_display_name} + {this.state.pushers[i].device_display_name} + ); + } + devicesSection = ( + + + + + {rows} +
    ApplicationDevice
    ); + } + var advancedSettings; if (externalRules.length) { advancedSettings = ( @@ -1010,6 +1046,10 @@ module.exports = React.createClass({ +

    Devices

    + + { devicesSection } + { advancedSettings } diff --git a/src/skins/vector/css/vector-web/views/settings/Notifications.css b/src/skins/vector/css/vector-web/views/settings/Notifications.css index 041958af75..f2f400600f 100644 --- a/src/skins/vector/css/vector-web/views/settings/Notifications.css +++ b/src/skins/vector/css/vector-web/views/settings/Notifications.css @@ -60,3 +60,11 @@ limitations under the License. cursor: pointer; color: #76cfa6; } + +.mx_UserSettings_devicesTable td { + padding-left: 20px; + padding-right: 20px; +} +.mx_UserSettings_devicesTable_nodevices { + font-style: italic; +}