mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-12-12 05:44:18 -05:00
Take object not bool
Allows bool as legacy fallback See https://github.com/matrix-org/matrix-doc/pull/212
This commit is contained in:
parent
84f2ad5dea
commit
41905784f7
@ -207,7 +207,12 @@ class PushRuleRestServlet(ClientV1RestServlet):
|
|||||||
|
|
||||||
def set_rule_attr(self, user_name, spec, val):
|
def set_rule_attr(self, user_name, spec, val):
|
||||||
if spec['attr'] == 'enabled':
|
if spec['attr'] == 'enabled':
|
||||||
|
if isinstance(val, dict) and "enabled" in val:
|
||||||
|
val = val["enabled"]
|
||||||
if not isinstance(val, bool):
|
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")
|
raise SynapseError(400, "Value for 'enabled' must be boolean")
|
||||||
namespaced_rule_id = _namespaced_rule_id_from_spec(spec)
|
namespaced_rule_id = _namespaced_rule_id_from_spec(spec)
|
||||||
self.hs.get_datastore().set_push_rule_enabled(
|
self.hs.get_datastore().set_push_rule_enabled(
|
||||||
|
Loading…
Reference in New Issue
Block a user