From 9279383e156059c97fc75f49571fa717bbc6be59 Mon Sep 17 00:00:00 2001 From: "H. Shay" Date: Thu, 18 Nov 2021 13:36:42 -0800 Subject: [PATCH 1/7] remove background update code related to deprecated config flag --- .../storage/databases/main/registration.py | 33 ------------------- 1 file changed, 33 deletions(-) diff --git a/synapse/storage/databases/main/registration.py b/synapse/storage/databases/main/registration.py index 7ee699f9819a..30b2c5b55abb 100644 --- a/synapse/storage/databases/main/registration.py +++ b/synapse/storage/databases/main/registration.py @@ -1727,10 +1727,6 @@ def __init__( "refresh_tokens_device_index" ) - self.db_pool.updates.register_background_update_handler( - "user_threepids_grandfather", self._bg_user_threepids_grandfather - ) - self.db_pool.updates.register_background_update_handler( "users_set_deactivated_flag", self._background_update_set_deactivated_flag ) @@ -1805,35 +1801,6 @@ def _background_update_set_deactivated_flag_txn(txn): return nb_processed - async def _bg_user_threepids_grandfather(self, progress, batch_size): - """We now track which identity servers a user binds their 3PID to, so - we need to handle the case of existing bindings where we didn't track - this. - - We do this by grandfathering in existing user threepids assuming that - they used one of the server configured trusted identity servers. - """ - id_servers = set(self.config.registration.trusted_third_party_id_servers) - - def _bg_user_threepids_grandfather_txn(txn): - sql = """ - INSERT INTO user_threepid_id_server - (user_id, medium, address, id_server) - SELECT user_id, medium, address, ? - FROM user_threepids - """ - - txn.execute_batch(sql, [(id_server,) for id_server in id_servers]) - - if id_servers: - await self.db_pool.runInteraction( - "_bg_user_threepids_grandfather", _bg_user_threepids_grandfather_txn - ) - - await self.db_pool.updates._end_background_update("user_threepids_grandfather") - - return 1 - async def set_user_deactivated_status( self, user_id: str, deactivated: bool ) -> None: From 20cbbd9c45b202dd404ebdb91b73742f3d7b1222 Mon Sep 17 00:00:00 2001 From: "H. Shay" Date: Thu, 18 Nov 2021 13:48:00 -0800 Subject: [PATCH 2/7] changelog entry --- changelog.d/11394.removal | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/11394.removal diff --git a/changelog.d/11394.removal b/changelog.d/11394.removal new file mode 100644 index 000000000000..3919d8815560 --- /dev/null +++ b/changelog.d/11394.removal @@ -0,0 +1 @@ +Remove code related to deprecated 'trust_identity_servers_for_password_resets' config flag. \ No newline at end of file From cb5e336e0b8fe3439b75cc813c19f66609907f3d Mon Sep 17 00:00:00 2001 From: "H. Shay" Date: Thu, 18 Nov 2021 17:09:55 -0800 Subject: [PATCH 3/7] update changelog --- changelog.d/11395.removal | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/11395.removal diff --git a/changelog.d/11395.removal b/changelog.d/11395.removal new file mode 100644 index 000000000000..3919d8815560 --- /dev/null +++ b/changelog.d/11395.removal @@ -0,0 +1 @@ +Remove code related to deprecated 'trust_identity_servers_for_password_resets' config flag. \ No newline at end of file From 4360c8fa8c58d63934317d81a34540a9f68f62c6 Mon Sep 17 00:00:00 2001 From: reivilibre Date: Fri, 19 Nov 2021 10:12:33 +0000 Subject: [PATCH 4/7] Delete 11394.removal Duplicate, wrong number --- changelog.d/11394.removal | 1 - 1 file changed, 1 deletion(-) delete mode 100644 changelog.d/11394.removal diff --git a/changelog.d/11394.removal b/changelog.d/11394.removal deleted file mode 100644 index 3919d8815560..000000000000 --- a/changelog.d/11394.removal +++ /dev/null @@ -1 +0,0 @@ -Remove code related to deprecated 'trust_identity_servers_for_password_resets' config flag. \ No newline at end of file From f32984a56fedc5d583306676edac1ac45cf04918 Mon Sep 17 00:00:00 2001 From: "H. Shay" Date: Fri, 19 Nov 2021 13:16:14 -0800 Subject: [PATCH 5/7] add no-op background update and change newfragment so it will be consolidated with associated work --- changelog.d/11395.removal | 2 +- synapse/storage/databases/main/registration.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/changelog.d/11395.removal b/changelog.d/11395.removal index 3919d8815560..6c1fd560adb3 100644 --- a/changelog.d/11395.removal +++ b/changelog.d/11395.removal @@ -1 +1 @@ -Remove code related to deprecated 'trust_identity_servers_for_password_resets' config flag. \ No newline at end of file +Remove deprecated `trust_identity_server_for_password_resets` configuration flag. \ No newline at end of file diff --git a/synapse/storage/databases/main/registration.py b/synapse/storage/databases/main/registration.py index 30b2c5b55abb..8478463a2a58 100644 --- a/synapse/storage/databases/main/registration.py +++ b/synapse/storage/databases/main/registration.py @@ -1731,6 +1731,10 @@ def __init__( "users_set_deactivated_flag", self._background_update_set_deactivated_flag ) + self.db_pool.updates.register_noop_background_update( + "user_threepids_grandfather" + ) + self.db_pool.updates.register_background_index_update( "user_external_ids_user_id_idx", index_name="user_external_ids_user_id_idx", From 10f31a1bae6896183466bbce8de218c9bb69fbbe Mon Sep 17 00:00:00 2001 From: "H. Shay" Date: Mon, 22 Nov 2021 12:13:07 -0800 Subject: [PATCH 6/7] remove unused code --- tests/utils.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/utils.py b/tests/utils.py index cf8ba5c5db35..983859120f55 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -119,7 +119,6 @@ def default_config(name, parse=False): "enable_registration": True, "enable_registration_captcha": False, "macaroon_secret_key": "not even a little secret", - "trusted_third_party_id_servers": [], "password_providers": [], "worker_replication_url": "", "worker_app": None, From 994d80dadda4fadcae6780278b26170a260fa182 Mon Sep 17 00:00:00 2001 From: "H. Shay" Date: Mon, 22 Nov 2021 12:19:40 -0800 Subject: [PATCH 7/7] Remove code associated with deprecated flag from legacy docker dynamic config file --- docker/conf/homeserver.yaml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/docker/conf/homeserver.yaml b/docker/conf/homeserver.yaml index 3cba594d0228..f10f78a48cd2 100644 --- a/docker/conf/homeserver.yaml +++ b/docker/conf/homeserver.yaml @@ -148,14 +148,6 @@ bcrypt_rounds: 12 allow_guest_access: {{ "True" if SYNAPSE_ALLOW_GUEST else "False" }} enable_group_creation: true -# The list of identity servers trusted to verify third party -# identifiers by this server. -# -# Also defines the ID server which will be called when an account is -# deactivated (one will be picked arbitrarily). -trusted_third_party_id_servers: - - matrix.org - - vector.im ## Metrics ###