matrix-js-sdk icon indicating copy to clipboard operation
matrix-js-sdk copied to clipboard

Fix age field check in event echo processing

Open stas-demydiuk opened this issue 2 years ago • 1 comments

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.

stas-demydiuk avatar Jul 28 '23 12:07 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.

isosphere avatar Jul 16 '24 23:07 isosphere

Related: https://github.com/element-hq/synapse/issues/8429

richvdh avatar Dec 05 '24 10:12 richvdh