summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2014-08-20 16:07:20 +0100
committerErik Johnston <erik@matrix.org>2014-08-20 17:09:44 +0100
commitebd3c41edeebcceb990fc3d60974c5166a7d143a (patch)
tree1e0c61fbc527b19f264d1b6bbc9112962fdea880
parentQuick fix to support array of room aliases (diff)
downloadsynapse-ebd3c41edeebcceb990fc3d60974c5166a7d143a.tar.xz
Make event stream storage return all membership events about the user, regardless of if they were in the room or not.
-rw-r--r--synapse/storage/stream.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/synapse/storage/stream.py b/synapse/storage/stream.py
index f2be275641..e994017bf2 100644
--- a/synapse/storage/stream.py
+++ b/synapse/storage/stream.py
@@ -151,10 +151,12 @@ class StreamStore(SQLBaseStore):
             "WHERE m.user_id = ?"
         )
 
-        invites_sql = (
+        # We also want to get any membership events about that user, e.g.
+        # invites or leave notifications.
+        membership_sql = (
             "SELECT m.event_id FROM room_memberships as m "
             "INNER JOIN current_state_events as c ON m.event_id = c.event_id "
-            "WHERE m.user_id = ? AND m.membership = ?"
+            "WHERE m.user_id = ? "
         )
 
         if limit:
@@ -178,13 +180,13 @@ class StreamStore(SQLBaseStore):
             "ORDER BY stream_ordering ASC LIMIT %(limit)d "
         ) % {
             "current": current_room_membership_sql,
-            "invites": invites_sql,
+            "invites": membership_sql,
             "limit": limit
         }
 
         rows = yield self._execute_and_decode(
             sql,
-            user_id, user_id, Membership.INVITE, from_id, to_id
+            user_id, user_id, from_id, to_id
         )
 
         ret = [self._parse_event_from_row(r) for r in rows]