From 05e479a76ca28d978222fead3ca7827c6b434ad6 Mon Sep 17 00:00:00 2001 From: Mark Haines Date: Wed, 16 Mar 2016 10:59:40 +0000 Subject: [PATCH] Use then() chaining rather than manual callbacks --- src/components/views/settings/Notifications.js | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/src/components/views/settings/Notifications.js b/src/components/views/settings/Notifications.js index c098775e7..792db55f7 100644 --- a/src/components/views/settings/Notifications.js +++ b/src/components/views/settings/Notifications.js @@ -558,19 +558,9 @@ module.exports = React.createClass({ // Create a push rule but disabled _addDisabledPushRule: function(scope, kind, ruleId, body) { var cli = MatrixClientPeg.get(); - var deferred = q.defer(); - - cli.addPushRule(scope, kind, ruleId, body).done(function() { - cli.setPushRuleEnabled(scope, kind, ruleId, false).done(function() { - deferred.resolve(); - }, function(err) { - deferred.reject(err); - }); - }, function(err) { - deferred.reject(err); + return cli.addPushRule(scope, kind, ruleId, body).then(function() { + return cli.setPushRuleEnabled(scope, kind, ruleId, false); }); - - return deferred.promise; }, // Check if any legacy im.vector rules need to be ported to the new API @@ -830,7 +820,6 @@ module.exports = React.createClass({ _updatePushRuleActions: function(rule, actions, enabled) { var cli = MatrixClientPeg.get(); - var deferred = q.defer(); return cli.setPushRuleActions( 'global', rule.kind, rule.rule_id, actions