diff options
author | Brendan Abolivier <babolivier@matrix.org> | 2019-11-06 15:47:40 +0000 |
---|---|---|
committer | Brendan Abolivier <babolivier@matrix.org> | 2019-11-06 15:47:40 +0000 |
commit | dfa60504af03d841b8dbf02b4a1420b3b5203618 (patch) | |
tree | 35e10f04a9a127a3bca2ccb9949272c6d301f799 /synapse/visibility.py | |
parent | Support for routing outbound HTTP requests via a proxy (#6239) (diff) | |
download | synapse-dfa60504af03d841b8dbf02b4a1420b3b5203618.tar.xz |
Don't apply retention policy based filtering on state events
As per MSC1763, 'Retention is only considered for non-state events.', so don't filter out state events based on the room's retention policy.
Diffstat (limited to 'synapse/visibility.py')
-rw-r--r-- | synapse/visibility.py | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/synapse/visibility.py b/synapse/visibility.py index 5b6562b481..79aa2ee1e2 100644 --- a/synapse/visibility.py +++ b/synapse/visibility.py @@ -115,14 +115,17 @@ def filter_events_for_client(store, user_id, events, is_peeking=False, if not event.is_state() and event.sender in ignore_list: return None - retention_policy = retention_policies[event.room_id] - max_lifetime = retention_policy.get("max_lifetime") + # Don't try to apply the room's retention policy if the event is a state event, as + # MSC1763 states that retention is only considered for non-state events. + if not event.is_state(): + retention_policy = retention_policies[event.room_id] + max_lifetime = retention_policy.get("max_lifetime") - if max_lifetime is not None: - oldest_allowed_ts = store.clock.time_msec() - max_lifetime + if max_lifetime is not None: + oldest_allowed_ts = store.clock.time_msec() - max_lifetime - if event.origin_server_ts < oldest_allowed_ts: - return None + if event.origin_server_ts < oldest_allowed_ts: + return None if event.event_id in always_include_ids: return event |