Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 21d74d5

Browse files
committed
Merge tag 'v1.45.1' into babolivier/dinsic_1.48.0
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](matrix-org/synapse#11127))
2 parents 22630d3 + 9b016a0 commit 21d74d5

File tree

6 files changed

+19
-63
lines changed

6 files changed

+19
-63
lines changed

CHANGES.md

+9
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
Synapse 1.45.1 (2021-10-20)
2+
===========================
3+
4+
Bugfixes
5+
--------
6+
7+
- 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))
8+
9+
110
Synapse 1.45.0 (2021-10-19)
211
===========================
312

debian/changelog

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
matrix-synapse-py3 (1.45.1) stable; urgency=medium
2+
3+
* New synapse release 1.45.1.
4+
5+
-- Synapse Packaging team <[email protected]> Wed, 20 Oct 2021 11:58:27 +0100
6+
17
matrix-synapse-py3 (1.45.0) stable; urgency=medium
28

39
* New synapse release 1.45.0.

synapse/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
except ImportError:
4848
pass
4949

50-
__version__ = "1.45.0"
50+
__version__ = "1.45.1"
5151

5252
if bool(os.environ.get("SYNAPSE_TEST_PATCH_LOG_CONTEXTS", False)):
5353
# We import here so that we don't have to install a bunch of deps when

synapse/handlers/deactivate_account.py

-4
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,6 @@ async def deactivate_account(
136136
# delete from user directory
137137
await self.user_directory_handler.handle_local_user_deactivated(user_id)
138138

139-
# If the user is present in the monthly active users table
140-
# remove them
141-
await self.store.remove_deactivated_user_from_mau_table(user_id)
142-
143139
# Mark the user as erased, if they asked for that
144140
if erase_data:
145141
user = UserID.from_string(user_id)

synapse/storage/databases/main/monthly_active_users.py

-24
Original file line numberDiff line numberDiff line change
@@ -354,27 +354,3 @@ async def populate_monthly_active_users(self, user_id):
354354
await self.upsert_monthly_active_user(user_id)
355355
elif now - last_seen_timestamp > LAST_SEEN_GRANULARITY:
356356
await self.upsert_monthly_active_user(user_id)
357-
358-
async def remove_deactivated_user_from_mau_table(self, user_id: str) -> None:
359-
"""
360-
Removes a deactivated user from the monthly active user
361-
table and resets affected caches.
362-
363-
Args:
364-
user_id(str): the user_id to remove
365-
"""
366-
367-
rows_deleted = await self.db_pool.simple_delete(
368-
table="monthly_active_users",
369-
keyvalues={"user_id": user_id},
370-
desc="simple_delete",
371-
)
372-
373-
if rows_deleted != 0:
374-
await self.invalidate_cache_and_stream(
375-
"user_last_seen_monthly_active", (user_id,)
376-
)
377-
await self.invalidate_cache_and_stream("get_monthly_active_count", ())
378-
await self.invalidate_cache_and_stream(
379-
"get_monthly_active_count_by_service", ()
380-
)

tests/test_mau.py

+3-34
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313
# limitations under the License.
1414

1515
"""Tests REST events for /rooms paths."""
16-
import synapse.rest.admin
16+
1717
from synapse.api.constants import APP_SERVICE_REGISTRATION_TYPE, LoginType
1818
from synapse.api.errors import Codes, HttpResponseException, SynapseError
1919
from synapse.appservice import ApplicationService
20-
from synapse.rest.client import login, profile, register, sync
20+
from synapse.rest.client import register, sync
2121

2222
from tests import unittest
2323
from tests.unittest import override_config
@@ -26,13 +26,7 @@
2626

2727
class TestMauLimit(unittest.HomeserverTestCase):
2828

29-
servlets = [
30-
register.register_servlets,
31-
sync.register_servlets,
32-
synapse.rest.admin.register_servlets_for_client_rest_resource,
33-
profile.register_servlets,
34-
login.register_servlets,
35-
]
29+
servlets = [register.register_servlets, sync.register_servlets]
3630

3731
def default_config(self):
3832
config = default_config("test")
@@ -235,31 +229,6 @@ def test_tracked_but_not_limited(self):
235229
self.reactor.advance(100)
236230
self.assertEqual(2, self.successResultOf(count))
237231

238-
def test_deactivated_users_dont_count_towards_mau(self):
239-
user1 = self.register_user("madonna", "password")
240-
self.register_user("prince", "password2")
241-
self.register_user("frodo", "onering", True)
242-
243-
token1 = self.login("madonna", "password")
244-
token2 = self.login("prince", "password2")
245-
admin_token = self.login("frodo", "onering")
246-
247-
self.do_sync_for_user(token1)
248-
self.do_sync_for_user(token2)
249-
250-
# Check that mau count is what we expect
251-
count = self.get_success(self.store.get_monthly_active_count())
252-
self.assertEqual(count, 2)
253-
254-
# Deactivate user1
255-
url = "/_synapse/admin/v1/deactivate/%s" % user1
256-
channel = self.make_request("POST", url, access_token=admin_token)
257-
self.assertIn("success", channel.json_body["id_server_unbind_result"])
258-
259-
# Check that deactivated user is no longer counted
260-
count = self.get_success(self.store.get_monthly_active_count())
261-
self.assertEqual(count, 1)
262-
263232
def create_user(self, localpart, token=None, appservice=False):
264233
request_data = {
265234
"username": localpart,

0 commit comments

Comments
 (0)