Expose the sticky event TTL to clients

This commit is contained in:
Olivier 'reivilibre
2026-01-16 09:00:00 +00:00
parent 71948ff2e3
commit b099d228e0
+9
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