-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: include sessionToken in onLiveQueryEvent #7043
Conversation
Codecov Report
@@ Coverage Diff @@
## master #7043 +/- ##
==========================================
+ Coverage 93.83% 93.86% +0.03%
==========================================
Files 169 169
Lines 12439 12438 -1
==========================================
+ Hits 11672 11675 +3
+ Misses 767 763 -4
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a comment and a nit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch! I can't believe I missed this.
Thanks for the review! Shoutout to @maxiqsoft for identifying the solution. |
@dblythy Actually I think passing the sessionToken should be enough. I don't know how I feel about doing a lookup for every live query event (could be hundreds of thousands of events). The developer can easily get the user from the sessionToken. What do you think @davimacedo |
This might be worth considering for Currently, afterLiveQueryEvent looks up request.user. |
I think with the installation ID and the session token now both being available, there are now 2 ways of inferring the user. A user lookup should be done optionally if needed, due to the look-up costs. |
That’s probably why I didn’t add sessionToken here because installationId was enough. |
As I mentioned in the original tread #1906:
So I think there is definitely an advantage of having the session token over the installation ID. |
Closes #1906.
If a sessionToken is passed onLiveQueryEvent, lookup the associated Parse.User, and set req.user.