fix: users.presence ignoring comma-separated IDs after OpenAPI migration
Merged
RI
5mo ago+50+50+01234567890123456789-1-1-0123456789
Proposed changes
Regression in 8.4.0: GET /v1/users.presence?ids=id1,id2,id3 returns an empty array when called with multiple comma-separated IDs. Single ID works fine. This breaks user presence on mobile, where everyone appears offline.
Root cause: PR #39553 (OpenAPI migration) added ajvQuery validation with anyOf: [string, array]. Combined with ajvQuery's coerceTypes: 'array', AJV coerces "id1,id2" into ["id1,id2"] (single-element array), skipping the .split(',') logic.
The endpoint accepts three formats:
?ids=userId1- single ID (string)?ids=userId1&ids=userId2- repeated params (array)?ids=userId1,userId2- comma-separated (string, but AJV coerces to["userId1,userId2"]β broken case)
Fix:
- Replaced
anyOfwithtype: ['string', 'array']to avoid AJV coercion issues (ajv#1140)
Issue(s)
Steps to test or reproduce
GET /v1/users.presence?ids=<userId>- single ID, returns the userGET /v1/users.presence?ids=<userId1>,<userId2>- comma-separated, returns empty (before fix), returns both (after fix)GET /v1/users.presence?ids=<userId1>&ids=<userId2>- repeated params, returns both
Summary by CodeRabbit
- Bug Fixes
- Fixed the
users.presenceendpoint to correctly handle multiple comma-separated user IDs instead of returning an empty array.
- Fixed the