mirror of
https://mau.dev/maunium/synapse.git
synced 2024-10-01 01:36:05 -04:00
Remove redundant room_version
param from check_auth_rules_from_context
It's now implied by the room_version property on the event.
This commit is contained in:
parent
0d9d36b15c
commit
c1b28b8842
@ -48,7 +48,6 @@ class EventAuthHandler:
|
||||
|
||||
async def check_auth_rules_from_context(
|
||||
self,
|
||||
room_version_obj: RoomVersion,
|
||||
event: EventBase,
|
||||
context: EventContext,
|
||||
) -> None:
|
||||
|
@ -799,9 +799,7 @@ class FederationHandler:
|
||||
|
||||
# The remote hasn't signed it yet, obviously. We'll do the full checks
|
||||
# when we get the event back in `on_send_join_request`
|
||||
await self._event_auth_handler.check_auth_rules_from_context(
|
||||
room_version, event, context
|
||||
)
|
||||
await self._event_auth_handler.check_auth_rules_from_context(event, context)
|
||||
return event
|
||||
|
||||
async def on_invite_request(
|
||||
@ -972,9 +970,7 @@ class FederationHandler:
|
||||
try:
|
||||
# The remote hasn't signed it yet, obviously. We'll do the full checks
|
||||
# when we get the event back in `on_send_leave_request`
|
||||
await self._event_auth_handler.check_auth_rules_from_context(
|
||||
room_version_obj, event, context
|
||||
)
|
||||
await self._event_auth_handler.check_auth_rules_from_context(event, context)
|
||||
except AuthError as e:
|
||||
logger.warning("Failed to create new leave %r because %s", event, e)
|
||||
raise e
|
||||
@ -1033,9 +1029,7 @@ class FederationHandler:
|
||||
try:
|
||||
# The remote hasn't signed it yet, obviously. We'll do the full checks
|
||||
# when we get the event back in `on_send_knock_request`
|
||||
await self._event_auth_handler.check_auth_rules_from_context(
|
||||
room_version_obj, event, context
|
||||
)
|
||||
await self._event_auth_handler.check_auth_rules_from_context(event, context)
|
||||
except AuthError as e:
|
||||
logger.warning("Failed to create new knock %r because %s", event, e)
|
||||
raise e
|
||||
@ -1208,7 +1202,7 @@ class FederationHandler:
|
||||
try:
|
||||
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 e:
|
||||
logger.warning("Denying new third party invite %r because %s", event, e)
|
||||
@ -1259,9 +1253,7 @@ class FederationHandler:
|
||||
|
||||
try:
|
||||
validate_event_for_room_version(event)
|
||||
await self._event_auth_handler.check_auth_rules_from_context(
|
||||
room_version_obj, event, context
|
||||
)
|
||||
await self._event_auth_handler.check_auth_rules_from_context(event, context)
|
||||
except AuthError as e:
|
||||
logger.warning("Denying third party invite %r because %s", event, e)
|
||||
raise e
|
||||
|
@ -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
|
||||
@ -1273,23 +1273,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.
|
||||
@ -1299,7 +1282,7 @@ class EventCreationHandler:
|
||||
try:
|
||||
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)
|
||||
|
@ -226,10 +226,9 @@ class RoomCreationHandler:
|
||||
},
|
||||
},
|
||||
)
|
||||
old_room_version = await self.store.get_room_version(old_room_id)
|
||||
validate_event_for_room_version(tombstone_event)
|
||||
await self._event_auth_handler.check_auth_rules_from_context(
|
||||
old_room_version, tombstone_event, tombstone_context
|
||||
tombstone_event, tombstone_context
|
||||
)
|
||||
|
||||
# Upgrade the room
|
||||
|
Loading…
Reference in New Issue
Block a user