avoid situation where the linkage data could be partially calculated#789
Merged
lgebhardt merged 2 commits intoJSONAPI-Resources:masterfrom Aug 31, 2016
Merged
Conversation
Collaborator
Author
|
Hold on with this. Need to manually test a bit more. |
Collaborator
Author
|
OK, I needed to guard against empty strings too. It should be good now. |
Contributor
|
@barelyknown Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The existing tests pass, though I did not take the time to create a failing test case for the situation (mostly because the easiest way would have been to test the
to_one_linkageandto_many_linkagemethods directly, and I didn't have time to figure out how to isolate them effectively).This fixes the situation where the current user does not have permission to access a relationship, and the library was returning a partially complete
dataobject for that relationship when it was polymorphic (theidwould be provided, but thetypewould be an empty string because of the way thatRelationship.type_for_sourceworks). To keep it all simple and avoid any side effects, I'm just not returning a partial data object (where either theidor thetypearenil) now.