Skip to content

Commit 0475bcd

Browse files
committed
PushRules settings: BF when changing state of the keywords rule with such a sequence: on -> off -> loud.
1 parent ac87830 commit 0475bcd

1 file changed

Lines changed: 15 additions & 4 deletions

File tree

‎src/components/views/settings/Notifications.js‎

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,9 @@ module.exports = React.createClass({
117117
}
118118

119119
if (actions) {
120-
// Note that the workaound in _updatePushRuleActions will automatically
120+
// Note that the workaround in _updatePushRuleActions will automatically
121121
// enable the rule
122-
deferreds.push(this._updatePushRuleActions(rule, actions));
122+
deferreds.push(this._updatePushRuleActions(rule, actions, enabled));
123123
}
124124
else if (enabled != undefined) {
125125
deferreds.push(cli.setPushRuleEnabled('global', rule.kind, rule.rule_id, enabled));
@@ -472,7 +472,7 @@ module.exports = React.createClass({
472472
});
473473
},
474474

475-
_updatePushRuleActions: function(rule, actions) {
475+
_updatePushRuleActions: function(rule, actions, enabled) {
476476
// Workaround for SYN-590 : Push rule update fails
477477
// Remove the rule and recreate it with the new actions
478478
var cli = MatrixClientPeg.get();
@@ -483,7 +483,18 @@ module.exports = React.createClass({
483483
actions: actions,
484484
pattern: rule.pattern
485485
}).done(function() {
486-
deferred.resolve();
486+
487+
// Then, if requested, enabled or disabled the rule
488+
if (undefined != enabled) {
489+
cli.setPushRuleEnabled('global', rule.kind, rule.rule_id, enabled).done(function() {
490+
deferred.resolve();
491+
}, function(err) {
492+
deferred.reject(err);
493+
});
494+
}
495+
else {
496+
deferred.resolve();
497+
}
487498
}, function(err) {
488499
deferred.reject(err);
489500
});

0 commit comments

Comments
 (0)