Don't push if an user account has expired (#8353)

This commit is contained in:
Mathieu Velten 2020-09-23 17:06:28 +02:00 committed by GitHub
parent 4bb203ea4f
commit 916bb9d0d1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 34 additions and 5 deletions

View file

@ -116,6 +116,20 @@ class RegistrationWorkerStore(SQLBaseStore):
desc="get_expiration_ts_for_user",
)
async def is_account_expired(self, user_id: str, current_ts: int) -> bool:
"""
Returns whether an user account is expired.
Args:
user_id: The user's ID
current_ts: The current timestamp
Returns:
Whether the user account has expired
"""
expiration_ts = await self.get_expiration_ts_for_user(user_id)
return expiration_ts is not None and current_ts >= expiration_ts
async def set_account_validity_for_user(
self,
user_id: str,