summary refs log tree commit diff
path: root/synapse/events
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2020-05-05 14:17:27 +0100
committerGitHub <noreply@github.com>2020-05-05 14:17:27 +0100
commit7941a70fa8b297b0dec320a9b7dda01df3efe1e4 (patch)
tree4e37a35d9f09889c5a19d43d862f1e04bf708a39 /synapse/events
parentFix ordering in MANIFEST.in (diff)
downloadsynapse-7941a70fa8b297b0dec320a9b7dda01df3efe1e4.tar.xz
Fix bug in EventContext.deserialize. (#7393)
This caused `prev_state_ids` to be incorrect if the state event was not
replacing an existing state entry.
Diffstat (limited to 'synapse/events')
-rw-r--r--synapse/events/snapshot.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/synapse/events/snapshot.py b/synapse/events/snapshot.py
index 9ea85e93e6..7c5f620d09 100644
--- a/synapse/events/snapshot.py
+++ b/synapse/events/snapshot.py
@@ -322,11 +322,14 @@ class _AsyncEventContextImpl(EventContext):
         self._current_state_ids = yield self._storage.state.get_state_ids_for_group(
             self.state_group
         )
-        if self._prev_state_id and self._event_state_key is not None:
+        if self._event_state_key is not None:
             self._prev_state_ids = dict(self._current_state_ids)
 
             key = (self._event_type, self._event_state_key)
-            self._prev_state_ids[key] = self._prev_state_id
+            if self._prev_state_id:
+                self._prev_state_ids[key] = self._prev_state_id
+            else:
+                self._prev_state_ids.pop(key, None)
         else:
             self._prev_state_ids = self._current_state_ids