summary refs log tree commit diff
path: root/synapse/state.py
diff options
context:
space:
mode:
Diffstat (limited to 'synapse/state.py')
-rw-r--r--synapse/state.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/synapse/state.py b/synapse/state.py
index 7fdf596006..5bfa73fb46 100644
--- a/synapse/state.py
+++ b/synapse/state.py
@@ -155,6 +155,12 @@ class StateHandler(object):
             else:
                 context.auth_events = {}
 
+            if event.is_state():
+                key = (event.type, event.state_key)
+                if key in context.current_state:
+                    replaces = context.current_state[key]
+                    event.unsigned["replaces_state"] = replaces.event_id
+
             defer.returnValue([])
 
         if event.is_state():
@@ -177,6 +183,12 @@ class StateHandler(object):
             prev_state
         )
 
+        if event.is_state():
+            key = (event.type, event.state_key)
+            if key in context.current_state:
+                replaces = context.current_state[key]
+                event.unsigned["replaces_state"] = replaces.event_id
+
         if hasattr(event, "auth_events") and event.auth_events:
             auth_ids = zip(*event.auth_events)[0]
             context.auth_events = {