diff options
author | Patrick Cloke <clokep@users.noreply.github.com> | 2022-11-22 14:08:04 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-22 14:08:04 -0500 |
commit | 6d47b7e32589e816eb766446cc1ff19ea73fc7c1 (patch) | |
tree | 3990c590d8fe0d442233790779b7fa62816ca2b2 /synapse/handlers/deactivate_account.py | |
parent | Apply correct editorconfig to .pyi files (#14526) (diff) | |
download | synapse-6d47b7e32589e816eb766446cc1ff19ea73fc7c1.tar.xz |
Add a type hint for `get_device_handler()` and fix incorrect types. (#14055)
This was the last untyped handler from the HomeServer object. Since it was being treated as Any (and thus unchecked) it was being used incorrectly in a few places.
Diffstat (limited to 'synapse/handlers/deactivate_account.py')
-rw-r--r-- | synapse/handlers/deactivate_account.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/synapse/handlers/deactivate_account.py b/synapse/handlers/deactivate_account.py index 816e1a6d79..d74d135c0c 100644 --- a/synapse/handlers/deactivate_account.py +++ b/synapse/handlers/deactivate_account.py @@ -16,6 +16,7 @@ import logging from typing import TYPE_CHECKING, Optional from synapse.api.errors import SynapseError +from synapse.handlers.device import DeviceHandler from synapse.metrics.background_process_metrics import run_as_background_process from synapse.types import Codes, Requester, UserID, create_requester @@ -76,6 +77,9 @@ class DeactivateAccountHandler: True if identity server supports removing threepids, otherwise False. """ + # This can only be called on the main process. + assert isinstance(self._device_handler, DeviceHandler) + # Check if this user can be deactivated if not await self._third_party_rules.check_can_deactivate_user( user_id, by_admin |