diff options
author | Daniel Wagner-Hall <dawagner@gmail.com> | 2015-12-07 10:44:35 +0000 |
---|---|---|
committer | Daniel Wagner-Hall <dawagner@gmail.com> | 2015-12-07 10:44:35 +0000 |
commit | 07d18dcab19ed63fedfda5f40d5a1d6f9cfff52d (patch) | |
tree | b781432e9d66cddeab48441906d3c388290a5c36 /synapse/rest/client/v1/push_rule.py | |
parent | Merge pull request #425 from MadsRC/develop (diff) | |
parent | Take object not bool (diff) | |
download | synapse-07d18dcab19ed63fedfda5f40d5a1d6f9cfff52d.tar.xz |
Merge pull request #424 from matrix-org/daniel/pushdictification
Take object not bool Allows bool as legacy fallback See https://github.com/matrix-org/matrix-doc/pull/212
Diffstat (limited to 'synapse/rest/client/v1/push_rule.py')
-rw-r--r-- | synapse/rest/client/v1/push_rule.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/synapse/rest/client/v1/push_rule.py b/synapse/rest/client/v1/push_rule.py index edf5b0ca41..9270bdd079 100644 --- a/synapse/rest/client/v1/push_rule.py +++ b/synapse/rest/client/v1/push_rule.py @@ -207,7 +207,12 @@ class PushRuleRestServlet(ClientV1RestServlet): def set_rule_attr(self, user_name, spec, val): if spec['attr'] == 'enabled': + if isinstance(val, dict) and "enabled" in val: + val = val["enabled"] if not isinstance(val, bool): + # Legacy fallback + # This should *actually* take a dict, but many clients pass + # bools directly, so let's not break them. raise SynapseError(400, "Value for 'enabled' must be boolean") namespaced_rule_id = _namespaced_rule_id_from_spec(spec) self.hs.get_datastore().set_push_rule_enabled( |