Expose the sticky event TTL to clients

This commit is contained in:
Olivier 'reivilibre 2025-12-22 14:27:59 +00:00
parent 42fa925e79
commit b2d83e6b85

View file

@ -237,6 +237,15 @@ async def filter_and_transform_events_for_client(
# to the cache!
cloned = clone_event(filtered)
cloned.unsigned[EventUnsignedContentFields.MEMBERSHIP] = user_membership
if storage.main.config.experimental.msc4354_enabled:
sticky_duration = cloned.sticky_duration()
if sticky_duration:
now = storage.main.clock.time_msec()
expires_at = min(cloned.origin_server_ts, now) + sticky_duration
if expires_at > now:
cloned.unsigned[EventUnsignedContentFields.STICKY_TTL] = (
expires_at - now
)
return cloned