diff options
author | Erik Johnston <erik@matrix.org> | 2019-01-28 17:00:14 +0000 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2019-01-28 17:00:14 +0000 |
commit | b872c7b1b43431b8933e2afd2f226aa34ad81a0f (patch) | |
tree | 43aaa8ab45163e9ca104436d7df82ed926702bf6 /synapse/handlers/message.py | |
parent | Fix UPSERTs on SQLite 3.24+ (#4477) (diff) | |
download | synapse-b872c7b1b43431b8933e2afd2f226aa34ad81a0f.tar.xz |
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.
Diffstat (limited to 'synapse/handlers/message.py')
-rw-r--r-- | synapse/handlers/message.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/synapse/handlers/message.py b/synapse/handlers/message.py index 7aaa4fba33..d2aab25111 100644 --- a/synapse/handlers/message.py +++ b/synapse/handlers/message.py @@ -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): |