From 2bfd4d8034fef049b40bcaffd5733ebb330ef475 Mon Sep 17 00:00:00 2001 From: Patrick Cloke Date: Wed, 26 Feb 2020 14:49:40 -0500 Subject: [PATCH] Use the reaplces state instead of the current state. --- synapse/handlers/message.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/synapse/handlers/message.py b/synapse/handlers/message.py index 81f0ec881048..05b5fb348ae9 100644 --- a/synapse/handlers/message.py +++ b/synapse/handlers/message.py @@ -890,14 +890,17 @@ def persist_and_notify_client_event( if event.type == EventTypes.CanonicalAlias: # Validate a newly added alias or newly added alt_aliases. - original_event = yield self.state.get_current_state( - event.room_id, EventTypes.CanonicalAlias, "" - ) original_alias = None original_alt_aliases = set() - if original_event: - original_alias = original_event.content.get("alias", None) - original_alt_aliases = original_event.content.get("alt_aliases", []) + + original_event_id = event.unsigned.get("replaces_state") + if original_event_id: + original_event = yield self.state.resolve_state_groups_for_events( + event.room_id, original_event_id) + + if original_event: + original_alias = original_event.content.get("alias", None) + original_alt_aliases = original_event.content.get("alt_aliases", []) # Check the alias is currently valid (if it has changed). room_alias_str = event.content.get("alias", None)