0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-12-15 06:03:50 +01:00

Include the event_id and stream_ordering of membership events when looking up which rooms a user is in

This commit is contained in:
Mark Haines 2015-09-08 18:14:54 +01:00
parent d23bc77e2c
commit 417485eefa

View file

@ -30,7 +30,7 @@ logger = logging.getLogger(__name__)
RoomsForUser = namedtuple( RoomsForUser = namedtuple(
"RoomsForUser", "RoomsForUser",
("room_id", "sender", "membership") ("room_id", "sender", "membership", "event_id", "stream_ordering")
) )
@ -141,9 +141,11 @@ class RoomMemberStore(SQLBaseStore):
args.extend(membership_list) args.extend(membership_list)
sql = ( 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" " FROM room_memberships as m"
" INNER JOIN current_state_events as c" " 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 " " ON m.event_id = c.event_id "
" AND m.room_id = c.room_id " " AND m.room_id = c.room_id "
" AND m.user_id = c.state_key" " AND m.user_id = c.state_key"