summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2016-09-14 11:16:22 +0100
committerErik Johnston <erik@matrix.org>2016-09-14 11:16:22 +0100
commitf2b2cd8eb4f82415a34285619d64ff7f01f8d9d6 (patch)
treeb50b100178808e8bae131e4182514460887e3f1e /synapse
parentFix reindex (diff)
downloadsynapse-f2b2cd8eb4f82415a34285619d64ff7f01f8d9d6.tar.xz
Amalgamate two identical consecutive if statements
Diffstat (limited to 'synapse')
-rw-r--r--synapse/state.py12
1 files changed, 5 insertions, 7 deletions
diff --git a/synapse/state.py b/synapse/state.py
index 617db8d2e2..d89aca26b1 100644
--- a/synapse/state.py
+++ b/synapse/state.py
@@ -238,13 +238,7 @@ class StateHandler(object):
         context.prev_state_ids = curr_state
         if event.is_state():
             context.state_group = self.store.get_next_state_group()
-        else:
-            if entry.state_group is None:
-                entry.state_group = self.store.get_next_state_group()
-                entry.state_id = entry.state_group
-            context.state_group = entry.state_group
 
-        if event.is_state():
             key = (event.type, event.state_key)
             if key in context.prev_state_ids:
                 replaces = context.prev_state_ids[key]
@@ -259,8 +253,12 @@ class StateHandler(object):
                 context.delta_ids = dict(context.delta_ids)
                 context.delta_ids[key] = event.event_id
         else:
-            context.current_state_ids = context.prev_state_ids
+            if entry.state_group is None:
+                entry.state_group = self.store.get_next_state_group()
+                entry.state_id = entry.state_group
 
+            context.state_group = entry.state_group
+            context.current_state_ids = context.prev_state_ids
             context.prev_group = entry.prev_group
             context.delta_ids = entry.delta_ids