summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2024-07-26 13:07:55 +0100
committerErik Johnston <erik@matrix.org>2024-07-26 13:07:55 +0100
commite06e3815b5908a8448be6138d1063833a1f75657 (patch)
treed46ad743c08cd793cc32a0daedeab516f86672f0
parentREVERT (diff)
downloadsynapse-e06e3815b5908a8448be6138d1063833a1f75657.tar.xz
REVERT
-rw-r--r--synapse/handlers/sliding_sync.py13
-rw-r--r--synapse/server_notices/server_notices_manager.py4
-rw-r--r--tests/rest/client/test_account.py2
-rw-r--r--tests/storage/test_roommember.py2
4 files changed, 11 insertions, 10 deletions
diff --git a/synapse/handlers/sliding_sync.py b/synapse/handlers/sliding_sync.py
index 0d621cbdd4..b88afc3db9 100644
--- a/synapse/handlers/sliding_sync.py
+++ b/synapse/handlers/sliding_sync.py
@@ -732,12 +732,13 @@ class SlidingSyncHandler:
 
         # First grab a current snapshot rooms for the user
         # (also handles forgotten rooms)
-        room_for_user_list = (
-            await self.store.get_rooms_for_local_user_where_membership_is(
-                user_id=user_id,
-                membership_list=Membership.LIST,
-                excluded_rooms=self.rooms_to_exclude_globally,
-            )
+        room_for_user_list = await self.store.get_rooms_for_local_user_where_membership_is(
+            user_id=user_id,
+            # We want to fetch any kind of membership (joined and left rooms) in order
+            # to get the `event_pos` of the latest room membership event for the
+            # user.
+            membership_list=Membership.LIST,
+            excluded_rooms=self.rooms_to_exclude_globally,
         )
 
         # If the user has never joined any rooms before, we can just return an empty list
diff --git a/synapse/server_notices/server_notices_manager.py b/synapse/server_notices/server_notices_manager.py
index e9cdc628d5..001a290e87 100644
--- a/synapse/server_notices/server_notices_manager.py
+++ b/synapse/server_notices/server_notices_manager.py
@@ -114,7 +114,7 @@ class ServerNoticesManager:
             return None
 
         rooms = await self._store.get_rooms_for_local_user_where_membership_is(
-            user_id, (Membership.INVITE, Membership.JOIN)
+            user_id, [Membership.INVITE, Membership.JOIN]
         )
         for room in rooms:
             # it's worth noting that there is an asymmetry here in that we
@@ -262,7 +262,7 @@ class ServerNoticesManager:
         # Check whether the user has already joined or been invited to this room. If
         # that's the case, there is no need to re-invite them.
         joined_rooms = await self._store.get_rooms_for_local_user_where_membership_is(
-            user_id, (Membership.INVITE, Membership.JOIN)
+            user_id, [Membership.INVITE, Membership.JOIN]
         )
         for room in joined_rooms:
             if room.room_id == room_id:
diff --git a/tests/rest/client/test_account.py b/tests/rest/client/test_account.py
index 77caab2489..a85ea994de 100644
--- a/tests/rest/client/test_account.py
+++ b/tests/rest/client/test_account.py
@@ -535,7 +535,7 @@ class DeactivateTestCase(unittest.HomeserverTestCase):
         # Check that the membership of @invitee:test in the room is now "leave".
         memberships = self.get_success(
             store.get_rooms_for_local_user_where_membership_is(
-                invitee_id, (Membership.LEAVE,)
+                invitee_id, [Membership.LEAVE]
             )
         )
         self.assertEqual(len(memberships), 1, memberships)
diff --git a/tests/storage/test_roommember.py b/tests/storage/test_roommember.py
index e2f19e25e3..418b556108 100644
--- a/tests/storage/test_roommember.py
+++ b/tests/storage/test_roommember.py
@@ -68,7 +68,7 @@ class RoomMemberStoreTestCase(unittest.HomeserverTestCase):
 
         rooms_for_user = self.get_success(
             self.store.get_rooms_for_local_user_where_membership_is(
-                self.u_alice, (Membership.JOIN,)
+                self.u_alice, [Membership.JOIN]
             )
         )