summary refs log tree commit diff
path: root/synapse/visibility.py
diff options
context:
space:
mode:
authorBrendan Abolivier <babolivier@matrix.org>2022-05-23 19:18:23 +0200
committerGitHub <noreply@github.com>2022-05-23 17:18:23 +0000
commit4cc4229cd7a55d2556c798fecbb1c9660dc821c8 (patch)
treebdcd296a05ae4fa0a147ccfe1e545e16f48ecd49 /synapse/visibility.py
parentadd SpamChecker callback for silently dropping inbound federated events (#12744) (diff)
downloadsynapse-4cc4229cd7a55d2556c798fecbb1c9660dc821c8.tar.xz
Prevent expired events from being filtered out when retention is disabled (#12611)
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
Diffstat (limited to 'synapse/visibility.py')
-rw-r--r--synapse/visibility.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/synapse/visibility.py b/synapse/visibility.py
index de6d2ffc52..da4af02796 100644
--- a/synapse/visibility.py
+++ b/synapse/visibility.py
@@ -22,7 +22,7 @@ from synapse.events import EventBase
 from synapse.events.utils import prune_event
 from synapse.storage import Storage
 from synapse.storage.state import StateFilter
-from synapse.types import StateMap, get_domain_from_id
+from synapse.types import RetentionPolicy, StateMap, get_domain_from_id
 
 logger = logging.getLogger(__name__)
 
@@ -94,7 +94,7 @@ async def filter_events_for_client(
 
     if filter_send_to_client:
         room_ids = {e.room_id for e in events}
-        retention_policies = {}
+        retention_policies: Dict[str, RetentionPolicy] = {}
 
         for room_id in room_ids:
             retention_policies[
@@ -137,7 +137,7 @@ async def filter_events_for_client(
             # events.
             if not event.is_state():
                 retention_policy = retention_policies[event.room_id]
-                max_lifetime = retention_policy.get("max_lifetime")
+                max_lifetime = retention_policy.max_lifetime
 
                 if max_lifetime is not None:
                     oldest_allowed_ts = storage.main.clock.time_msec() - max_lifetime