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

Commit

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

0 comments on commit 2bfd4d8

Please sign in to comment.