-
-
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
Before Connect + Before Subscribe help required #6793
Conversation
Here are the failing tests |
@dblythy Can you give me access to your master branch? It's best practice to create a separate branch for every PR. |
Thanks for the tip @dplewis. I've invited you to my branch. |
Got it. I’ll review in the AM. |
@dblythy I need to add a few more tests. Is there anything else that should be returned in |
@dblythy This beforeSubscribe will need a tiny update on the JS SDK to properly handle errors |
@dplewis thank you so much for your help again. Is it worth creating a test to make sure modifying req.query affects the subscription? |
No problem, add as many tests as you need. |
Ok, no worries. So once the JS SDK is updated, the tests should pass and we can submit the PR? 😊 |
Codecov Report
@@ Coverage Diff @@
## master #6793 +/- ##
==========================================
- Coverage 93.93% 93.87% -0.07%
==========================================
Files 169 169
Lines 12054 12197 +143
==========================================
+ Hits 11323 11450 +127
- Misses 731 747 +16
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.
LGTM
Maybe we can add the trigger "afterDisconnect" too? |
@jadsonlourenco I believe you can use onLiveQueryEvent for running a function after a disconnect. |
Yes, I'm using, but like this PR did, if we have a trigger to handle before connect on a "live" system is good to know when the client disconnect, using it as Parse api will be more easy to implement, just to make the Parse api more complete, I think. |
Hey guys,
This is my second attempt at creating two new cloud code triggers which affect LiveQuery: beforeConnect and beforeSubscribe.
beforeConnect allows validation prior to a LiveQuery opening connection. This is not class specific.
beforeSubscribe handles the .subscribe methods from LiveQuery. Can be used to validate users, or to mutate the request.query, enforcing fields, equalTo, or whatever required.
However, as I'm a JS noob, I'm struggling to create tests that will pass. I was wondering if someone would be kind to help me close this out (I'll buy you a box of beers because I've been pulling my hair out trying to work this out).
Also my linter changed some other things, couldn't work out how to stop it (again, I'm a VS noob too).
Thank you all for your hard work!!