mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-07-31 22:38:31 -04:00
Additional constants for EDU types. (#12884)
Instead of hard-coding strings in many places.
This commit is contained in:
parent
d9f092285b
commit
c52abc1cfd
35 changed files with 146 additions and 96 deletions
|
@ -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:
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue