summary refs log tree commit diff
path: root/synapse/rest/client/push_rule.py
diff options
context:
space:
mode:
authorPatrick Cloke <clokep@users.noreply.github.com>2023-05-09 10:34:10 -0400
committerGitHub <noreply@github.com>2023-05-09 10:34:10 -0400
commit4b4e0dc3cecbe9ad65c4728c1ec461321d15789f (patch)
treebba2f02650eac695bb7e1f27f552b2a9c7d60f83 /synapse/rest/client/push_rule.py
parentUse account data constants in more places. (#15554) (diff)
downloadsynapse-4b4e0dc3cecbe9ad65c4728c1ec461321d15789f.tar.xz
Error if attempting to set m.push_rules account data, per MSC4010. (#15555)
m.push_rules, like m.fully_read, is a special account data type that cannot
be set using the normal /account_data endpoint. Return an error instead
of allowing data that will not be used to be stored.
Diffstat (limited to 'synapse/rest/client/push_rule.py')
-rw-r--r--synapse/rest/client/push_rule.py7
1 files changed, 2 insertions, 5 deletions
diff --git a/synapse/rest/client/push_rule.py b/synapse/rest/client/push_rule.py

index 1147b6f8ec..5c9fece3ba 100644 --- a/synapse/rest/client/push_rule.py +++ b/synapse/rest/client/push_rule.py
@@ -28,7 +28,6 @@ from synapse.http.servlet import ( parse_string, ) from synapse.http.site import SynapseRequest -from synapse.push.clientformat import format_push_rules_for_user from synapse.push.rulekinds import PRIORITY_CLASS_MAP from synapse.rest.client._base import client_patterns from synapse.storage.push_rule import InconsistentRuleException, RuleNotFoundException @@ -146,14 +145,12 @@ class PushRuleRestServlet(RestServlet): async def on_GET(self, request: SynapseRequest, path: str) -> Tuple[int, JsonDict]: requester = await self.auth.get_user_by_req(request) - user_id = requester.user.to_string() + requester.user.to_string() # we build up the full structure and then decide which bits of it # to send which means doing unnecessary work sometimes but is # is probably not going to make a whole lot of difference - rules_raw = await self.store.get_push_rules_for_user(user_id) - - rules = format_push_rules_for_user(requester.user, rules_raw) + rules = await self._push_rules_handler.push_rules_for_user(requester.user) path_parts = path.split("/")[1:]