summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorMark Haines <mark.haines@matrix.org>2015-09-08 18:14:54 +0100
committerMark Haines <mark.haines@matrix.org>2015-09-08 18:14:54 +0100
commit417485eefaff86206b5f961102f882b3fbe44651 (patch)
tree463ff9c3482ce84e4e5bccbda80469d18be276af /synapse
parentMerge branch 'master' into develop (diff)
downloadsynapse-417485eefaff86206b5f961102f882b3fbe44651.tar.xz
Include the event_id and stream_ordering of membership events when looking up which rooms a user is in
Diffstat (limited to 'synapse')
-rw-r--r--synapse/storage/roommember.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/synapse/storage/roommember.py b/synapse/storage/roommember.py
index 8eee2dfbcc..cd9eefbd9f 100644
--- a/synapse/storage/roommember.py
+++ b/synapse/storage/roommember.py
@@ -30,7 +30,7 @@ logger = logging.getLogger(__name__)
 
 RoomsForUser = namedtuple(
     "RoomsForUser",
-    ("room_id", "sender", "membership")
+    ("room_id", "sender", "membership", "event_id", "stream_ordering")
 )
 
 
@@ -141,9 +141,11 @@ class RoomMemberStore(SQLBaseStore):
         args.extend(membership_list)
 
         sql = (
-            "SELECT m.room_id, m.sender, m.membership"
+            "SELECT m.room_id, m.sender, m.membership, m.event_id, e.stream_ordering"
             " FROM room_memberships as m"
             " INNER JOIN current_state_events as c"
+            " ON e.event_id = c.event_id "
+            " INNER JOIN events as e "
             " ON m.event_id = c.event_id "
             " AND m.room_id = c.room_id "
             " AND m.user_id = c.state_key"