summary refs log tree commit diff
path: root/synapse/push
diff options
context:
space:
mode:
authorMathieu Velten <matmaul@gmail.com>2020-09-23 17:06:28 +0200
committerGitHub <noreply@github.com>2020-09-23 16:06:28 +0100
commit916bb9d0d15cf941e73b2e808c553a1edd1c2eb9 (patch)
tree9938653b43064cd6f66f6fb633f1f00cb24f1fd4 /synapse/push
parentFix missing null character check on guest_access room state (#8373) (diff)
downloadsynapse-916bb9d0d15cf941e73b2e808c553a1edd1c2eb9.tar.xz
Don't push if an user account has expired (#8353)
Diffstat (limited to 'synapse/push')
-rw-r--r--synapse/push/pusherpool.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/synapse/push/pusherpool.py b/synapse/push/pusherpool.py
index cc839ffce4..76150e117b 100644
--- a/synapse/push/pusherpool.py
+++ b/synapse/push/pusherpool.py
@@ -60,6 +60,8 @@ class PusherPool:
         self.store = self.hs.get_datastore()
         self.clock = self.hs.get_clock()
 
+        self._account_validity = hs.config.account_validity
+
         # We shard the handling of push notifications by user ID.
         self._pusher_shard_config = hs.config.push.pusher_shard_config
         self._instance_name = hs.get_instance_name()
@@ -202,6 +204,14 @@ class PusherPool:
             )
 
             for u in users_affected:
+                # Don't push if the user account has expired
+                if self._account_validity.enabled:
+                    expired = await self.store.is_account_expired(
+                        u, self.clock.time_msec()
+                    )
+                    if expired:
+                        continue
+
                 if u in self.pushers:
                     for p in self.pushers[u].values():
                         p.on_new_notifications(max_stream_id)
@@ -222,6 +232,14 @@ class PusherPool:
             )
 
             for u in users_affected:
+                # Don't push if the user account has expired
+                if self._account_validity.enabled:
+                    expired = await self.store.is_account_expired(
+                        u, self.clock.time_msec()
+                    )
+                    if expired:
+                        continue
+
                 if u in self.pushers:
                     for p in self.pushers[u].values():
                         p.on_new_receipts(min_stream_id, max_stream_id)