diff options
author | Patrick Cloke <patrickc@matrix.org> | 2022-10-14 14:11:27 -0400 |
---|---|---|
committer | Patrick Cloke <patrickc@matrix.org> | 2022-10-14 14:11:27 -0400 |
commit | bc2bd92b930288f3c4bb08a72d8dba24d7416ffd (patch) | |
tree | fffa5bb099b5aa81e27a9b663a22bd57cc3300fe /synapse/replication | |
parent | Accept threaded receipts for events related to the root event. (#14174) (diff) | |
parent | 1.69.0rc4 (diff) | |
download | synapse-bc2bd92b930288f3c4bb08a72d8dba24d7416ffd.tar.xz |
Merge remote-tracking branch 'origin/release-v1.69' into develop
Diffstat (limited to 'synapse/replication')
-rw-r--r-- | synapse/replication/http/register.py | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/synapse/replication/http/register.py b/synapse/replication/http/register.py index 61abb529c8..976c283360 100644 --- a/synapse/replication/http/register.py +++ b/synapse/replication/http/register.py @@ -39,6 +39,16 @@ class ReplicationRegisterServlet(ReplicationEndpoint): self.store = hs.get_datastores().main self.registration_handler = hs.get_registration_handler() + # Default value if the worker that sent the replication request did not include + # an 'approved' property. + if ( + hs.config.experimental.msc3866.enabled + and hs.config.experimental.msc3866.require_approval_for_new_accounts + ): + self._approval_default = False + else: + self._approval_default = True + @staticmethod async def _serialize_payload( # type: ignore[override] user_id: str, @@ -92,6 +102,12 @@ class ReplicationRegisterServlet(ReplicationEndpoint): await self.registration_handler.check_registration_ratelimit(content["address"]) + # Always default admin users to approved (since it means they were created by + # an admin). + approved_default = self._approval_default + if content["admin"]: + approved_default = True + await self.registration_handler.register_with_store( user_id=user_id, password_hash=content["password_hash"], @@ -103,7 +119,7 @@ class ReplicationRegisterServlet(ReplicationEndpoint): user_type=content["user_type"], address=content["address"], shadow_banned=content["shadow_banned"], - approved=content["approved"], + approved=content.get("approved", approved_default), ) return 200, {} |