Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Use the replaces state instead of the current state.
Browse files Browse the repository at this point in the history
  • Loading branch information
clokep committed Feb 27, 2020
1 parent a02057d commit fcd8f69
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions synapse/handlers/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit fcd8f69

Please sign in to comment.