summary refs log tree commit diff
path: root/synapse/handlers/message.py
diff options
context:
space:
mode:
authorEric Eastwood <erice@element.io>2021-11-03 02:10:07 -0500
committerEric Eastwood <erice@element.io>2021-11-03 02:10:07 -0500
commitec35be57e056a795f7ebe393c81ffcb5bccd5872 (patch)
tree5a592e56da1016f180e1097bee20f03425b74539 /synapse/handlers/message.py
parentFix lints (diff)
parentAdd index to `local_group_updates.stream_id` (#11231) (diff)
downloadsynapse-ec35be57e056a795f7ebe393c81ffcb5bccd5872.tar.xz
Merge branch 'develop' into madlittlemods/return-historical-events-in-order-from-backfill
Conflicts:
	scripts-dev/complement.sh
	synapse/handlers/federation_event.py
	synapse/handlers/message.py
	synapse/storage/databases/main/event_federation.py
Diffstat (limited to 'synapse/handlers/message.py')
-rw-r--r--synapse/handlers/message.py24
1 files changed, 17 insertions, 7 deletions
diff --git a/synapse/handlers/message.py b/synapse/handlers/message.py

index 2f4b458d45..916ba0662d 100644 --- a/synapse/handlers/message.py +++ b/synapse/handlers/message.py
@@ -1328,6 +1328,8 @@ class EventCreationHandler: # user is actually admin or not). is_admin_redaction = False if event.type == EventTypes.Redaction: + assert event.redacts is not None + original_event = await self.store.get_event( event.redacts, redact_behaviour=EventRedactBehaviour.AS_IS, @@ -1423,6 +1425,8 @@ class EventCreationHandler: ) if event.type == EventTypes.Redaction: + assert event.redacts is not None + original_event = await self.store.get_event( event.redacts, redact_behaviour=EventRedactBehaviour.AS_IS, @@ -1510,11 +1514,14 @@ class EventCreationHandler: next_batch_id = event.content.get( EventContentFields.MSC2716_NEXT_BATCH_ID ) - conflicting_insertion_event_id = ( - await self.store.get_insertion_event_id_by_batch_id( - event.room_id, next_batch_id + + conflicting_insertion_event_id = None + if next_batch_id: + conflicting_insertion_event_id = ( + await self.store.get_insertion_event_id_by_batch_id( + event.room_id, next_batch_id + ) ) - ) if conflicting_insertion_event_id is not None: # The current insertion event that we're processing is invalid # because an insertion event already exists in the room with the @@ -1547,13 +1554,16 @@ class EventCreationHandler: # If there's an expiry timestamp on the event, schedule its expiry. self._message_handler.maybe_schedule_expiry(event) - def _notify() -> None: + async def _notify() -> None: try: - self.notifier.on_new_room_event( + await self.notifier.on_new_room_event( event, event_pos, max_stream_token, extra_users=extra_users ) except Exception: - logger.exception("Error notifying about new room event") + logger.exception( + "Error notifying about new room event %s", + event.event_id, + ) run_in_background(_notify)