summary refs log tree commit diff
path: root/synapse/api
diff options
context:
space:
mode:
authorPatrick Cloke <clokep@users.noreply.github.com>2022-05-27 07:14:36 -0400
committerGitHub <noreply@github.com>2022-05-27 07:14:36 -0400
commitc52abc1cfdd9e5480cdb4a03d626fe61cacc6573 (patch)
tree0859f49a5d1e69ce8c844ba9d785c67a2a747854 /synapse/api
parentRemove federation client code for groups. (#12563) (diff)
downloadsynapse-c52abc1cfdd9e5480cdb4a03d626fe61cacc6573.tar.xz
Additional constants for EDU types. (#12884)
Instead of hard-coding strings in many places.
Diffstat (limited to 'synapse/api')
-rw-r--r--synapse/api/constants.py8
-rw-r--r--synapse/api/filtering.py4
2 files changed, 9 insertions, 3 deletions
diff --git a/synapse/api/constants.py b/synapse/api/constants.py
index 4a0552e7e5..f03fdd6dae 100644
--- a/synapse/api/constants.py
+++ b/synapse/api/constants.py
@@ -137,7 +137,13 @@ class DeviceKeyAlgorithms:
 
 
 class EduTypes:
-    Presence: Final = "m.presence"
+    PRESENCE: Final = "m.presence"
+    TYPING: Final = "m.typing"
+    RECEIPT: Final = "m.receipt"
+    DEVICE_LIST_UPDATE: Final = "m.device_list_update"
+    SIGNING_KEY_UPDATE: Final = "m.signing_key_update"
+    UNSTABLE_SIGNING_KEY_UPDATE: Final = "org.matrix.signing_key_update"
+    DIRECT_TO_DEVICE: Final = "m.direct_to_device"
 
 
 class RejectedReason:
diff --git a/synapse/api/filtering.py b/synapse/api/filtering.py
index b91ce06de7..b007147519 100644
--- a/synapse/api/filtering.py
+++ b/synapse/api/filtering.py
@@ -33,7 +33,7 @@ from typing import (
 import jsonschema
 from jsonschema import FormatChecker
 
-from synapse.api.constants import EventContentFields
+from synapse.api.constants import EduTypes, EventContentFields
 from synapse.api.errors import SynapseError
 from synapse.api.presence import UserPresenceState
 from synapse.events import EventBase
@@ -347,7 +347,7 @@ class Filter:
             user_id = event.user_id
             field_matchers = {
                 "senders": lambda v: user_id == v,
-                "types": lambda v: "m.presence" == v,
+                "types": lambda v: EduTypes.PRESENCE == v,
             }
             return self._check_fields(field_matchers)
         else: