From fcd8f69e39c0b5ede1d7cc8126c316f0ed8f042c Mon Sep 17 00:00:00 2001 From: Patrick Cloke Date: Wed, 26 Feb 2020 14:49:40 -0500 Subject: [PATCH] Use the replaces state instead of the current state. --- synapse/handlers/message.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/synapse/handlers/message.py b/synapse/handlers/message.py index 81f0ec881048..905a39329806 100644 --- a/synapse/handlers/message.py +++ b/synapse/handlers/message.py @@ -890,14 +890,16 @@ 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.store.get_event(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)