@@ -601,7 +601,7 @@ module.exports = React.createClass({
601601
602602 _refreshFromServer : function ( ) {
603603 var self = this ;
604- MatrixClientPeg . get ( ) . getPushRules ( ) . then ( self . _portRulesToNewAPI ) . done ( function ( rulesets ) {
604+ var pushRulesPromise = MatrixClientPeg . get ( ) . getPushRules ( ) . then ( self . _portRulesToNewAPI ) . done ( function ( rulesets ) {
605605 MatrixClientPeg . get ( ) . pushRules = rulesets ;
606606
607607 // Get homeserver default rules and triage them by categories
@@ -811,10 +811,20 @@ module.exports = React.createClass({
811811 self . state . externalPushRules . push ( rule ) ;
812812 }
813813 }
814+ } ) ;
815+
816+ var pushersPromise = MatrixClientPeg . get ( ) . getPushers ( ) . then ( function ( resp ) {
817+ self . setState ( { pushers : resp . pushers } ) ;
818+ } ) ;
814819
820+ q . all ( [ pushRulesPromise , pushersPromise ] ) . done ( function ( ) {
815821 self . setState ( {
816822 phase : self . phases . DISPLAY
817823 } ) ;
824+ } , function ( error ) {
825+ self . setState ( {
826+ phase : self . phases . ERROR
827+ } ) ;
818828 } ) ;
819829 } ,
820830
@@ -936,6 +946,32 @@ module.exports = React.createClass({
936946 externalRules . push ( < li > Notifications on the following keywords follow rules which can’t be displayed here: { externalKeyWords } </ li > ) ;
937947 }
938948
949+ var devicesSection ;
950+ if ( this . state . pushers === undefined ) {
951+ devicesSection = < div className = "error" > Unable to fetch device list</ div >
952+ } else if ( this . state . pushers . length == 0 ) {
953+ devicesSection = < div className = "mx_UserSettings_devicesTable_nodevices" >
954+ No devices are receiving push notifications
955+ </ div >
956+ } else {
957+ // It would be great to be able to delete pushers from here too,
958+ // and this wouldn't be hard to add.
959+ var rows = [ ] ;
960+ for ( var i = 0 ; i < this . state . pushers . length ; ++ i ) {
961+ rows . push ( < tr >
962+ < td > { this . state . pushers [ i ] . app_display_name } </ td >
963+ < td > { this . state . pushers [ i ] . device_display_name } </ td >
964+ </ tr > ) ;
965+ }
966+ devicesSection = ( < table className = "mx_UserSettings_devicesTable" >
967+ < tr >
968+ < th > Application</ th >
969+ < th > Device</ th >
970+ </ tr >
971+ { rows }
972+ </ table > ) ;
973+ }
974+
939975 var advancedSettings ;
940976 if ( externalRules . length ) {
941977 advancedSettings = (
@@ -1010,6 +1046,10 @@ module.exports = React.createClass({
10101046 </ table >
10111047 </ div >
10121048
1049+ < h3 > Devices</ h3 >
1050+
1051+ { devicesSection }
1052+
10131053 { advancedSettings }
10141054
10151055 </ div >
0 commit comments