regression: reject past expiresAt dates when setting a status#41048
Conversation
|
Looks like this PR is ready to merge! 🎉 |
|
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## release-8.6.0 #41048 +/- ##
=================================================
- Coverage 70.10% 70.10% -0.01%
=================================================
Files 3360 3360
Lines 129668 129672 +4
Branches 22470 22493 +23
=================================================
+ Hits 90905 90907 +2
+ Misses 35457 35455 -2
- Partials 3306 3310 +4
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
1 issue found across 4 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
Proposed changes (including videos or screenshots)
users.setStatusaccepted any validexpiresAt, including past dates — a status that's already expired the moment it's applied and never reschedules correctly.This rejects past (and invalid) expirations at two layers:
users.setStatus): rejectsexpiresAt <= nowwitherror-invalid-date("expiresAt must be a future date"). NaN is already caught by the existing invalid-date-string check.Presence.setActiveState): throws on aNaNor paststatusExpiresAtbefore dispatching, covering callers that bypass the REST endpoint.Also removes a dead
validStatusarray check that duplicated schema-level validation, and tightens the body type toExclude<UserStatus, UserStatus.DISABLED>.Issue(s)
Steps to test or reproduce
POST /api/v1/users.setStatuswith{ "status": "busy", "expiresAt": "2020-01-01T00:00:00.000Z" }.400,errorType: "error-invalid-date", errorexpiresAt must be a future date [error-invalid-date].expiresAtstill succeeds and returnsstatusExpiresAt.Covered by tests in
apps/meteor/tests/end-to-end/api/users.tsandee/packages/presence/src/Presence.spec.ts.Summary by CodeRabbit
Bug Fixes
DISABLEDstatus value in status update requests.Tests