diff options
author | Eric Eastwood <eric.eastwood@beta.gouv.fr> | 2024-06-04 12:58:03 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-04 12:58:03 -0500 |
commit | 7d8f0ef351e99adf602b3acb67b2516a02ff6918 (patch) | |
tree | f8fdbcd3578d0866a236e589062b80360f549a3b /synapse/storage/databases | |
parent | Merge branch 'release-v1.109' into develop (diff) | |
download | synapse-7d8f0ef351e99adf602b3acb67b2516a02ff6918.tar.xz |
Use fully-qualified `PersistedEventPosition` when returning `RoomsForUser` (#17265)
Use fully-qualified `PersistedEventPosition` (`instance_name` and `stream_ordering`) when returning `RoomsForUser` to facilitate proper comparisons and `RoomStreamToken` generation. Spawning from https://github.com/element-hq/synapse/pull/17187 where we want to utilize this change
Diffstat (limited to 'synapse/storage/databases')
-rw-r--r-- | synapse/storage/databases/main/roommember.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/synapse/storage/databases/main/roommember.py b/synapse/storage/databases/main/roommember.py index 9fddbb2caf..d8b54dc4e3 100644 --- a/synapse/storage/databases/main/roommember.py +++ b/synapse/storage/databases/main/roommember.py @@ -476,7 +476,7 @@ class RoomMemberWorkerStore(EventsWorkerStore, CacheInvalidationWorkerStore): ) sql = """ - SELECT room_id, e.sender, c.membership, event_id, e.stream_ordering, r.room_version + SELECT room_id, e.sender, c.membership, event_id, e.instance_name, e.stream_ordering, r.room_version FROM local_current_membership AS c INNER JOIN events AS e USING (room_id, event_id) INNER JOIN rooms AS r USING (room_id) @@ -488,7 +488,17 @@ class RoomMemberWorkerStore(EventsWorkerStore, CacheInvalidationWorkerStore): ) txn.execute(sql, (user_id, *args)) - results = [RoomsForUser(*r) for r in txn] + results = [ + RoomsForUser( + room_id=room_id, + sender=sender, + membership=membership, + event_id=event_id, + event_pos=PersistedEventPosition(instance_name, stream_ordering), + room_version_id=room_version, + ) + for room_id, sender, membership, event_id, instance_name, stream_ordering, room_version in txn + ] return results |