mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 11:16:07 -04:00
Split up event validation between event and builder
The validator was being run on the EventBuilder objects, and so the validator only checked a subset of fields. With the upcoming EventBuilder refactor even fewer fields will be there to validate. To get around this we split the validation into those that can be run against an EventBuilder and those run against a fully fledged event.
This commit is contained in:
parent
7072fe3084
commit
b872c7b1b4
3 changed files with 63 additions and 25 deletions
|
@ -288,7 +288,7 @@ class EventCreationHandler(object):
|
|||
|
||||
builder = self.event_builder_factory.new(room_version, event_dict)
|
||||
|
||||
self.validator.validate_new(builder)
|
||||
self.validator.validate_builder(builder)
|
||||
|
||||
if builder.type == EventTypes.Member:
|
||||
membership = builder.content.get("membership", None)
|
||||
|
@ -326,6 +326,8 @@ class EventCreationHandler(object):
|
|||
prev_events_and_hashes=prev_events_and_hashes,
|
||||
)
|
||||
|
||||
self.validator.validate_new(event)
|
||||
|
||||
defer.returnValue((event, context))
|
||||
|
||||
def _is_exempt_from_privacy_policy(self, builder, requester):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue