mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-08-06 19:54:11 -04:00
Test room alias deletion (#11327)
* Prefer `HTTPStatus` over plain `int` This is an Opinion that no-one has seemed to object to yet. * `--disallow-untyped-defs` for `tests.rest.client.test_directory` * Improve synapse's annotations for deleting aliases * Test case for deleting a room alias * Changelog
This commit is contained in:
parent
0bcae8ad56
commit
bea815cec8
5 changed files with 91 additions and 31 deletions
|
@ -204,6 +204,10 @@ class DirectoryHandler:
|
|||
)
|
||||
|
||||
room_id = await self._delete_association(room_alias)
|
||||
if room_id is None:
|
||||
# It's possible someone else deleted the association after the
|
||||
# checks above, but before we did the deletion.
|
||||
raise NotFoundError("Unknown room alias")
|
||||
|
||||
try:
|
||||
await self._update_canonical_alias(requester, user_id, room_id, room_alias)
|
||||
|
@ -225,7 +229,7 @@ class DirectoryHandler:
|
|||
)
|
||||
await self._delete_association(room_alias)
|
||||
|
||||
async def _delete_association(self, room_alias: RoomAlias) -> str:
|
||||
async def _delete_association(self, room_alias: RoomAlias) -> Optional[str]:
|
||||
if not self.hs.is_mine(room_alias):
|
||||
raise SynapseError(400, "Room alias must be local")
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue