summary refs log tree commit diff
diff options
context:
space:
mode:
authorSean Quah <seanq@element.io>2021-10-20 13:43:02 +0100
committerSean Quah <seanq@element.io>2021-10-20 13:43:02 +0100
commitee2cee5f529402e060e0a1567b438d2b6026cddb (patch)
treef672584864e2aa1cf22b02231b2a092accfddf91
parentRemove false warning about copying the log config to a homeserver.yaml (#11092) (diff)
parentRemove link to #10947 from changelog (diff)
downloadsynapse-ee2cee5f529402e060e0a1567b438d2b6026cddb.tar.xz
Merge branch 'master' into develop
-rw-r--r--CHANGES.md9
-rw-r--r--debian/changelog6
-rw-r--r--synapse/__init__.py2
-rw-r--r--synapse/handlers/deactivate_account.py4
-rw-r--r--synapse/storage/databases/main/monthly_active_users.py24
-rw-r--r--tests/test_mau.py37
6 files changed, 19 insertions, 63 deletions
diff --git a/CHANGES.md b/CHANGES.md
index 435387d7b0..92e6c6873e 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -1,3 +1,12 @@
+Synapse 1.45.1 (2021-10-20)
+===========================
+
+Bugfixes
+--------
+
+- Revert change to counting of deactivated users towards the monthly active users limit, introduced in 1.45.0rc1. ([\#11127](https://github.com/matrix-org/synapse/issues/11127))
+
+
 Synapse 1.45.0 (2021-10-19)
 ===========================
 
diff --git a/debian/changelog b/debian/changelog
index 5fefb2f2ac..1ee81f2a34 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+matrix-synapse-py3 (1.45.1) stable; urgency=medium
+
+  * New synapse release 1.45.1.
+
+ -- Synapse Packaging team <packages@matrix.org>  Wed, 20 Oct 2021 11:58:27 +0100
+
 matrix-synapse-py3 (1.45.0) stable; urgency=medium
 
   * New synapse release 1.45.0.
diff --git a/synapse/__init__.py b/synapse/__init__.py
index 97452f34fe..2687d932ea 100644
--- a/synapse/__init__.py
+++ b/synapse/__init__.py
@@ -47,7 +47,7 @@ try:
 except ImportError:
     pass
 
-__version__ = "1.45.0"
+__version__ = "1.45.1"
 
 if bool(os.environ.get("SYNAPSE_TEST_PATCH_LOG_CONTEXTS", False)):
     # We import here so that we don't have to install a bunch of deps when
diff --git a/synapse/handlers/deactivate_account.py b/synapse/handlers/deactivate_account.py
index e88c3c27ce..bee62cf360 100644
--- a/synapse/handlers/deactivate_account.py
+++ b/synapse/handlers/deactivate_account.py
@@ -131,10 +131,6 @@ class DeactivateAccountHandler:
         # delete from user directory
         await self.user_directory_handler.handle_local_user_deactivated(user_id)
 
-        # If the user is present in the monthly active users table
-        # remove them
-        await self.store.remove_deactivated_user_from_mau_table(user_id)
-
         # Mark the user as erased, if they asked for that
         if erase_data:
             user = UserID.from_string(user_id)
diff --git a/synapse/storage/databases/main/monthly_active_users.py b/synapse/storage/databases/main/monthly_active_users.py
index ec4d47a560..a14ac03d4b 100644
--- a/synapse/storage/databases/main/monthly_active_users.py
+++ b/synapse/storage/databases/main/monthly_active_users.py
@@ -354,27 +354,3 @@ class MonthlyActiveUsersStore(MonthlyActiveUsersWorkerStore):
                         await self.upsert_monthly_active_user(user_id)
             elif now - last_seen_timestamp > LAST_SEEN_GRANULARITY:
                 await self.upsert_monthly_active_user(user_id)
-
-    async def remove_deactivated_user_from_mau_table(self, user_id: str) -> None:
-        """
-        Removes a deactivated user from the monthly active user
-        table and resets affected caches.
-
-        Args:
-            user_id(str): the user_id to remove
-        """
-
-        rows_deleted = await self.db_pool.simple_delete(
-            table="monthly_active_users",
-            keyvalues={"user_id": user_id},
-            desc="simple_delete",
-        )
-
-        if rows_deleted != 0:
-            await self.invalidate_cache_and_stream(
-                "user_last_seen_monthly_active", (user_id,)
-            )
-            await self.invalidate_cache_and_stream("get_monthly_active_count", ())
-            await self.invalidate_cache_and_stream(
-                "get_monthly_active_count_by_service", ()
-            )
diff --git a/tests/test_mau.py b/tests/test_mau.py
index c683c8937e..80ab40e255 100644
--- a/tests/test_mau.py
+++ b/tests/test_mau.py
@@ -13,11 +13,11 @@
 # limitations under the License.
 
 """Tests REST events for /rooms paths."""
-import synapse.rest.admin
+
 from synapse.api.constants import APP_SERVICE_REGISTRATION_TYPE, LoginType
 from synapse.api.errors import Codes, HttpResponseException, SynapseError
 from synapse.appservice import ApplicationService
-from synapse.rest.client import login, profile, register, sync
+from synapse.rest.client import register, sync
 
 from tests import unittest
 from tests.unittest import override_config
@@ -26,13 +26,7 @@ from tests.utils import default_config
 
 class TestMauLimit(unittest.HomeserverTestCase):
 
-    servlets = [
-        register.register_servlets,
-        sync.register_servlets,
-        synapse.rest.admin.register_servlets_for_client_rest_resource,
-        profile.register_servlets,
-        login.register_servlets,
-    ]
+    servlets = [register.register_servlets, sync.register_servlets]
 
     def default_config(self):
         config = default_config("test")
@@ -235,31 +229,6 @@ class TestMauLimit(unittest.HomeserverTestCase):
         self.reactor.advance(100)
         self.assertEqual(2, self.successResultOf(count))
 
-    def test_deactivated_users_dont_count_towards_mau(self):
-        user1 = self.register_user("madonna", "password")
-        self.register_user("prince", "password2")
-        self.register_user("frodo", "onering", True)
-
-        token1 = self.login("madonna", "password")
-        token2 = self.login("prince", "password2")
-        admin_token = self.login("frodo", "onering")
-
-        self.do_sync_for_user(token1)
-        self.do_sync_for_user(token2)
-
-        # Check that mau count is what we expect
-        count = self.get_success(self.store.get_monthly_active_count())
-        self.assertEqual(count, 2)
-
-        # Deactivate user1
-        url = "/_synapse/admin/v1/deactivate/%s" % user1
-        channel = self.make_request("POST", url, access_token=admin_token)
-        self.assertIn("success", channel.json_body["id_server_unbind_result"])
-
-        # Check that deactivated user is no longer counted
-        count = self.get_success(self.store.get_monthly_active_count())
-        self.assertEqual(count, 1)
-
     def create_user(self, localpart, token=None, appservice=False):
         request_data = {
             "username": localpart,