summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2017-05-26 10:46:03 +0100
committerErik Johnston <erik@matrix.org>2017-05-26 10:46:03 +0100
commit619e8ecd0c123602c20eb3a4ce45bdefb79d5900 (patch)
treeb522d67dc21d11f496cd52d6a86c2851af718135 /synapse
parentFix typing tests (diff)
downloadsynapse-619e8ecd0c123602c20eb3a4ce45bdefb79d5900.tar.xz
Handle None state group correctly
Diffstat (limited to 'synapse')
-rw-r--r--synapse/state.py6
-rw-r--r--synapse/storage/roommember.py5
2 files changed, 7 insertions, 4 deletions
diff --git a/synapse/state.py b/synapse/state.py
index 95dbe02e50..5fbe0a0977 100644
--- a/synapse/state.py
+++ b/synapse/state.py
@@ -364,11 +364,11 @@ class StateHandler(object):
 
             prev_group = None
             delta_ids = None
-            for old_group, old_ids in state_groups_ids.items():
-                if not set(new_state.iterkeys()) - set(old_ids.iterkeys()):
+            for old_group, old_ids in state_groups_ids.iteritems():
+                if not set(new_state) - set(old_ids):
                     n_delta_ids = {
                         k: v
-                        for k, v in new_state.items()
+                        for k, v in new_state.iteritems()
                         if old_ids.get(k) != v
                     }
                     if not delta_ids or len(n_delta_ids) < len(delta_ids):
diff --git a/synapse/storage/roommember.py b/synapse/storage/roommember.py
index 8c4a5f9f2e..0e9e71f600 100644
--- a/synapse/storage/roommember.py
+++ b/synapse/storage/roommember.py
@@ -692,7 +692,10 @@ class _JoinedHostsCache(object):
                     host = intern_string(get_domain_from_id(user_id))
                     self.hosts_to_joined_users.setdefault(host, set()).add(user_id)
 
-            self.state_group = state_entry.state_group
+            if state_entry.state_group:
+                self.state_group = state_entry.state_group
+            else:
+                self.state_group = object()
             self._len = sum(len(v) for v in self.hosts_to_joined_users.itervalues())
         defer.returnValue(frozenset(self.hosts_to_joined_users))