Fix imsync's SELECT query to only find the rooms I'm actually joined in, not every room I have ever joined
This commit is contained in:
parent
5c88e57555
commit
3c532314ec
|
@ -111,9 +111,12 @@ class RoomMemberStore(SQLBaseStore):
|
||||||
for membership in membership_list:
|
for membership in membership_list:
|
||||||
args.append(membership)
|
args.append(membership)
|
||||||
|
|
||||||
|
# sub-select finds the row ID for the most recent (i.e. current)
|
||||||
|
# state change of this user per room, then the outer select finds those
|
||||||
query = ("SELECT room_id, membership FROM room_memberships"
|
query = ("SELECT room_id, membership FROM room_memberships"
|
||||||
+ " WHERE user_id=? AND " + where_membership
|
+ " WHERE id IN (SELECT MAX(id) FROM room_memberships"
|
||||||
+ " GROUP BY room_id ORDER BY id DESC")
|
+ " WHERE user_id=? GROUP BY room_id)"
|
||||||
|
+ " AND " + where_membership)
|
||||||
return self._execute(
|
return self._execute(
|
||||||
self.cursor_to_dict, query, *args
|
self.cursor_to_dict, query, *args
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue