Fix age field check in event echo processing
Address an edge case when the server does not return the age field for some reason (as it seems like it is optional according to spec) to avoid NaN value in the event's localTimestamp field
Fixes https://github.com/vector-im/element-web/issues/25875
Signed-off-by: Stanislav Demydiuk [email protected]
Checklist
- [ ] Tests written for new code (and old code if feasible)
- [x] Linter and other CI checks pass
- [x] Sign-off given on the changes (see CONTRIBUTING.md)
Here's what your changelog entry will look like:
🐛 Bug Fixes
- Fix age field check in event echo processing (#3635). Fixes vector-im/element-web#25875. Contributed by @stas-demydiuk.
Looks sane to me, thank you for taking care of this!
Would you be able to reference the piece of the spec in the pull request that mentions it is optional and add a test to validate the behaviour you're covering now?
If you check https://spec.matrix.org/v1.11/client-server-api/#room-event-format
Scroll down a little to ClientEvent, it says of the entire unsigned field:
Contains optional extra information about the event.
Everything that is unsigned is optional.
Related: https://github.com/element-hq/synapse/issues/8429