mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-15 07:52:16 -04:00
Add mau_appservice_trial_days
config (#12619)
* Add mau_appservice_trial_days * Add a test * Tweaks * changelog * Ensure we sync after the delay * Fix types * Add config statement * Fix test * Reinstate logging that got removed * Fix feature name
This commit is contained in:
parent
7fbf42499d
commit
2d74a8c178
6 changed files with 110 additions and 2 deletions
|
@ -215,7 +215,8 @@ class RegistrationWorkerStore(CacheInvalidationWorkerStore):
|
|||
|
||||
async def is_trial_user(self, user_id: str) -> bool:
|
||||
"""Checks if user is in the "trial" period, i.e. within the first
|
||||
N days of registration defined by `mau_trial_days` config
|
||||
N days of registration defined by `mau_trial_days` config or the
|
||||
`mau_appservice_trial_days` config.
|
||||
|
||||
Args:
|
||||
user_id: The user to check for trial status.
|
||||
|
@ -226,7 +227,10 @@ class RegistrationWorkerStore(CacheInvalidationWorkerStore):
|
|||
return False
|
||||
|
||||
now = self._clock.time_msec()
|
||||
trial_duration_ms = self.config.server.mau_trial_days * 24 * 60 * 60 * 1000
|
||||
days = self.config.server.mau_appservice_trial_days.get(
|
||||
info["appservice_id"], self.config.server.mau_trial_days
|
||||
)
|
||||
trial_duration_ms = days * 24 * 60 * 60 * 1000
|
||||
is_trial = (now - info["creation_ts"] * 1000) < trial_duration_ms
|
||||
return is_trial
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue