Skip to content

Properly allow fields of type 'File' within _GlobalConfig #3458

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

Closed
wants to merge 4 commits into from

Conversation

mross22
Copy link

@mross22 mross22 commented Jan 31, 2017

Fixes #3457

@mross22
Copy link
Author

mross22 commented Feb 1, 2017

Looks like the test failures are unrelated to my change and there is a PR out to improve test flakiness, so I will push again later to re-trigger the build

@aontas
Copy link
Contributor

aontas commented Feb 3, 2017

It would be appreciated if you could also add support for GeoPoints (they have the same issue).

Also, could you add a test to https://github.com/ParsePlatform/parse-server/blob/master/spec/ParseGlobalConfig.spec.js that adds a file/geopoint so that further rewrites don't cause this fix to disappear.

@mross22
Copy link
Author

mross22 commented Feb 6, 2017

@aontas sure, ill make the update for GeoPoint as well and update the PR.

I added a test for the file that I touched because I noticed that if I tried to repro the issue through ParseGlobalConfig.spec.js it didn't repro (so thus my test to demonstrate the failure passed from the start). I didn't have a chance to look into it too deeply but i assume there is some difference in the testing case (or in the adapter) that differs from the prod behavior.

@mross22 mross22 closed this Feb 6, 2017
@mross22 mross22 reopened this Feb 6, 2017
@facebook-github-bot
Copy link

@mross22 updated the pull request - view changes

return GeoPointCoder.JSONToDatabase(atom);
// normally we transform a 'GeoPoint' to just the name when storing to the db, but
// _GlobalConfig has no schema so we must preserve type information and other fields
return className === "_GlobalConfig" ? atom : GeoPointCoder.JSONToDatabase(atom);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm really not a big fan of using that className hard coded like that in this method that should know nothing about the className.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, at the very least I can move this logic outside of this function but I get its still not ideal to have this component care about the className

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup... Try moving it outside and see how it goes :)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link

@rijonkhan rijonkhan Feb 6, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@flovilmart
Copy link
Contributor

@mross22 thanks for getting onto that problem, however at the moment, I believe the implementation is not bullet proof, we'll need something else. I'll have a look later today for a proper suggestion of the implementation.

@facebook-github-bot
Copy link

@mross22 updated the pull request - view changes

@flovilmart
Copy link
Contributor

flovilmart commented Feb 19, 2017

@mross22 Thanks for the PR, actually I found the real issue behind it.

The Config object is stored with a _Schema with only one property, params, when we run updates, we use the 'dot' notation params.key1 = value, params.key2 = value2 in order to update only the required keys in the params object.

Hoewever, those 'keys', were considered 'topLevel' which is bad, as they clearly are NOT. (they's interior keys).

Interior keys do not suffer transformation, therefore the fix is cleaner and has a larger scope. There was actually a bug that would affect all updates using the dot notation.

Thanks for your PR however, that helped a lot identifying the root of the issue :)

I've opened #3531 and we can expect a merge and a release soon.

@flovilmart flovilmart closed this Feb 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants