diff options
author | Erik Johnston <erik@matrix.org> | 2023-03-21 09:13:43 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-21 09:13:43 +0000 |
commit | 827f198177c4cf547b9d2d1eed41411e945fc199 (patch) | |
tree | 385e8599e006bf8b18b737d4ea5005151ec4eff5 /tests/rest/admin/test_room.py | |
parent | Separate HTTP preview code and URL previewer. (#15269) (diff) | |
download | synapse-827f198177c4cf547b9d2d1eed41411e945fc199.tar.xz |
Fix error when sending message into deleted room. (#15235)
When a room is deleted in Synapse we remove the event forward extremities in the room, so if (say a bot) tries to send a message into the room we error out due to not being able to calculate prev events for the new event *before* we check if the sender is in the room. Fixes #8094
Diffstat (limited to 'tests/rest/admin/test_room.py')
-rw-r--r-- | tests/rest/admin/test_room.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/rest/admin/test_room.py b/tests/rest/admin/test_room.py index 9dbb778679..eb50086c50 100644 --- a/tests/rest/admin/test_room.py +++ b/tests/rest/admin/test_room.py @@ -402,6 +402,21 @@ class DeleteRoomTestCase(unittest.HomeserverTestCase): # Assert we can no longer peek into the room self._assert_peek(self.room_id, expect_code=403) + def test_room_delete_send(self) -> None: + """Test that sending into a deleted room returns a 403""" + channel = self.make_request( + "DELETE", + self.url, + content={}, + access_token=self.admin_user_tok, + ) + + self.assertEqual(200, channel.code, msg=channel.json_body) + + self.helper.send( + self.room_id, "test message", expect_code=403, tok=self.other_user_tok + ) + def _is_blocked(self, room_id: str, expect: bool = True) -> None: """Assert that the room is blocked or not""" d = self.store.is_room_blocked(room_id) |