diff options
author | Richard van der Hoff <richard@matrix.org> | 2022-06-13 11:34:59 +0100 |
---|---|---|
committer | Richard van der Hoff <richard@matrix.org> | 2022-06-13 11:34:59 +0100 |
commit | f68b5e5773a9e74c0f895190aaedce41f8565fa7 (patch) | |
tree | 0601c8b98bc68e25e7466cd220d8034cac29f27f /synapse/handlers/message.py | |
parent | Revert "Changelog" (diff) | |
parent | changelog (diff) | |
download | synapse-f68b5e5773a9e74c0f895190aaedce41f8565fa7.tar.xz |
Merge branch 'rav/simplify_event_auth_interface' into develop
Diffstat (limited to 'synapse/handlers/message.py')
-rw-r--r-- | synapse/handlers/message.py | 23 |
1 files changed, 3 insertions, 20 deletions
diff --git a/synapse/handlers/message.py b/synapse/handlers/message.py index 294217cc23..9b17939163 100644 --- a/synapse/handlers/message.py +++ b/synapse/handlers/message.py @@ -42,7 +42,7 @@ from synapse.api.errors import ( SynapseError, UnsupportedRoomVersionError, ) -from synapse.api.room_versions import KNOWN_ROOM_VERSIONS, RoomVersions +from synapse.api.room_versions import KNOWN_ROOM_VERSIONS from synapse.api.urls import ConsentURIBuilder from synapse.event_auth import validate_event_for_room_version from synapse.events import EventBase, relation_from_event @@ -1274,23 +1274,6 @@ class EventCreationHandler: ) return prev_event - if event.is_state() and (event.type, event.state_key) == ( - EventTypes.Create, - "", - ): - room_version_id = event.content.get( - "room_version", RoomVersions.V1.identifier - ) - maybe_room_version_obj = KNOWN_ROOM_VERSIONS.get(room_version_id) - if not maybe_room_version_obj: - raise UnsupportedRoomVersionError( - "Attempt to create a room with unsupported room version %s" - % (room_version_id,) - ) - room_version_obj = maybe_room_version_obj - else: - room_version_obj = await self.store.get_room_version(event.room_id) - if event.internal_metadata.is_out_of_band_membership(): # the only sort of out-of-band-membership events we expect to see here are # invite rejections and rescinded knocks that we have generated ourselves. @@ -1298,9 +1281,9 @@ class EventCreationHandler: assert event.content["membership"] == Membership.LEAVE else: try: - validate_event_for_room_version(room_version_obj, event) + validate_event_for_room_version(event) await self._event_auth_handler.check_auth_rules_from_context( - room_version_obj, event, context + event, context ) except AuthError as err: logger.warning("Denying new event %r because %s", event, err) |