diff options
-rw-r--r-- | synapse/handlers/federation.py | 14 | ||||
-rw-r--r-- | synapse/handlers/message.py | 2 |
2 files changed, 14 insertions, 2 deletions
diff --git a/synapse/handlers/federation.py b/synapse/handlers/federation.py index 5b270228e7..8391728bdb 100644 --- a/synapse/handlers/federation.py +++ b/synapse/handlers/federation.py @@ -17,6 +17,7 @@ """Contains handlers for federation events.""" +import collections import itertools import logging from collections.abc import Container @@ -1368,9 +1369,20 @@ class FederationHandler(BaseHandler): self.config.worker.writers.events, "events", max_stream_id ) + predecessor = None + for s in state: + if s.type == EventTypes.Create: + predecessor = s.content.get("predecessor", None) + + # Ensure the key is a dictionary + if not isinstance(predecessor, collections.abc.Mapping): + predecessor = None + + break + # Check whether this room is the result of an upgrade of a room we already know # about. If so, migrate over user information - predecessor = await self.store.get_room_predecessor(room_id) + # predecessor = await self.store.get_room_predecessor(room_id) if not predecessor or not isinstance(predecessor.get("room_id"), str): return event.event_id, max_stream_id old_room_id = predecessor["room_id"] diff --git a/synapse/handlers/message.py b/synapse/handlers/message.py index 67d9f95202..c955a86be0 100644 --- a/synapse/handlers/message.py +++ b/synapse/handlers/message.py @@ -675,7 +675,7 @@ class EventCreationHandler(object): event.event_id, prev_event.event_id, ) - return await self.store.get_stream_token_for_event(prev_event.event_id) + return await self.store.get_stream_id_for_event(prev_event.event_id) return await self.handle_new_client_event( requester=requester, event=event, context=context, ratelimit=ratelimit |