-
-
Notifications
You must be signed in to change notification settings - Fork 735
Fixed: ParseUser.getCurrentUser() returns a non authenticated user when local datastore is used #3
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
Conversation
I'm not convinced that this is where the actual problem lies, since we shouldn't be overwriting |
If the server returns the query that contains a reference to the There are different ways to fix this. We need to add a special case somewhere: What do you think? |
One interesting thing to note is that the server normally returns the |
If that's the case, it seems like this current modification will have some unintended side affects such as stale data such as keys that were removed on the server persisting after a We'd probably want to have a more precise fix that is conditional upon the Additionally, this should be verified with actual code that hits the server, but the PR should contain a unit test that prevents this from happening in the future. |
@@ -501,6 +501,15 @@ private void restoreAnonymity(Map<String, String> anonymousData) { | |||
} | |||
|
|||
@Override | |||
void setState(ParseObject.State newState) { |
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.
For future PRs, we use /* package */
to designate package protected methods.
This is looking much better! Just an optimization and a few minor nits. |
dd5ac96
to
c6e2493
Compare
} | ||
else { | ||
super.setState(newState); | ||
} |
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.
This logic seems a tad messy, could we simplify it to the following?
if (/* ... */) {
newState = // ...
}
super.setState(newState);
Sorry, I realized that there are some additional use cases that we should cover in the tests. |
…en local datastore is used Repro project: https://www.dropbox.com/s/m6vl215mg3nj8uo/Parse-Starter-Project-1.9.4.zip 1- change keys 2- click SIGN UP -> make sure a user & a post are created 3- click GETCURRENTUSER -> make sure user and session are shown 4- click ISAUTHENTICATED() -> make sure it returns true 5- now click QUERY DATA WITH INCLUDE("USER") 6- repeat step 3 and 4 and notice the issue
Looks awesome, thanks! Also same comments RE commits, etc. as I made on your other diff. |
Fixed: ParseUser.getCurrentUser() returns a non authenticated user when local datastore is used
@lukas1994 updated the pull request. |
337 332 workitems
Repro project: https://www.dropbox.com/s/m6vl215mg3nj8uo/Parse-Starter-Project-1.9.4.zip
1- change keys
2- click SIGN UP
-> make sure a user & a post are created
3- click GETCURRENTUSER
-> make sure user and session are shown
4- click ISAUTHENTICATED()
-> make sure it returns true
5- now click QUERY DATA WITH INCLUDE("USER")
6- repeat step 3 and 4 and notice the issue