diff options
author | Nicolas Werner <89468146+nico-famedly@users.noreply.github.com> | 2023-06-21 15:56:31 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-21 14:56:31 +0100 |
commit | e0c39d6bb526b01368393ae5d2173c8e6d39b60f (patch) | |
tree | 9ec2262342e86043ef8df1ae5560dd76cd509fbd /tests/handlers | |
parent | Fix harmless exception in port DB script (#15814) (diff) | |
download | synapse-e0c39d6bb526b01368393ae5d2173c8e6d39b60f.tar.xz |
Fix forgotten rooms missing in initial sync (#15815)
If you leave a room and forget it, then rejoin it, the room would be missing from the next initial sync. fixes #13262 Signed-off-by: Nicolas Werner <n.werner@famedly.com>
Diffstat (limited to 'tests/handlers')
-rw-r--r-- | tests/handlers/test_room_member.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/handlers/test_room_member.py b/tests/handlers/test_room_member.py index a444d822cd..41199ffa29 100644 --- a/tests/handlers/test_room_member.py +++ b/tests/handlers/test_room_member.py @@ -333,6 +333,27 @@ class RoomMemberMasterHandlerTestCase(HomeserverTestCase): self.get_success(self.store.is_locally_forgotten_room(self.room_id)) ) + def test_leave_and_unforget(self) -> None: + """Tests if rejoining a room unforgets the room, so that it shows up in sync again.""" + self.helper.join(self.room_id, user=self.bob, tok=self.bob_token) + + # alice is not the last room member that leaves and forgets the room + self.helper.leave(self.room_id, user=self.alice, tok=self.alice_token) + self.get_success(self.handler.forget(self.alice_ID, self.room_id)) + self.assertTrue( + self.get_success(self.store.did_forget(self.alice, self.room_id)) + ) + + self.helper.join(self.room_id, user=self.alice, tok=self.alice_token) + self.assertFalse( + self.get_success(self.store.did_forget(self.alice, self.room_id)) + ) + + # the server has not forgotten the room + self.assertFalse( + self.get_success(self.store.is_locally_forgotten_room(self.room_id)) + ) + @override_config({"forget_rooms_on_leave": True}) def test_leave_and_auto_forget(self) -> None: """Tests the `forget_rooms_on_leave` config option.""" |