Repository navigation
fix: Original object missing in afterSave trigger and LiveQuery event on login with authData - #10920
Albert1603 wants to merge 1 commit into
Conversation
…nt on login with authData Login with authData matches an existing user without an update query, so `afterSave` and LiveQuery received no original object and the login looked like a sign-up. Keep a copy of the matched user before the auth validation and the authData update change the response, and use it as the original object. File fields of the copy get their URLs like the response. LiveQuery now sends the login as an update event. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
🚀 Thanks for opening this pull request! We appreciate your effort in improving the project. Please let us know once your pull request is ready for review. Tip
Note Please respond to review comments from AI agents just like you would to comments from a human reviewer. Let the reviewer resolve their own comments, unless they have reviewed and accepted your commit, or agreed with your explanation for why the feedback was incorrect. Caution Pull requests must be written using an AI agent with human supervision. Pull requests written entirely by a human will likely be rejected, because of lower code quality, higher review effort and the higher risk of introducing bugs. Please note that AI review comments on this pull request alone do not satisfy this requirement. Our CI and AI review are safeguards, not development tools. If many issues are flagged, rethink your development approach. Invest more effort in planning and design rather than using review cycles to fix low-quality code. |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Pull Request
Issue
Closes: #7737
Related: #7742, which adds a failing test for this issue.
Approach
A
POST /usersrequest with authData that matches an existing user is a login. It has no update query, soRestWritebuilt no original object:request.originalwasundefinedin the_UserafterSavetrigger, and the login looked like a sign-up to Cloud Code and to LiveQuery.The matched user is now copied before the auth validation and the authData update change the response, and the copy is used as the original object. File fields of the copy get their URLs like the response.
The fix adds no database read or write.
RestWrite.originalDatais not set, because it is also used to build the response and the trigger object of an update.Sign-up, update and linking of authData are not changed.
afterSavestill runs on login, also for providers that update authData or usedoNotSave.Notes for review:
createtoupdate. A login with authData now sends anupdateevent with an original object to LiveQuery subscribers, as the user already exists. For this reason I changed one expectation in the test for GHSA-f92h-3w9f-hg55 inspec/vulnerabilities.spec.jsfromcreatetoupdate, and added a check that the original object in the event has no authData. The other checks of that test pass unchanged.protectedFieldsTriggerExemptset totrueand tofalse.Tasks
🤖 Generated with Claude Code
Summary by CodeRabbit