-
Notifications
You must be signed in to change notification settings - Fork 256
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
[#3512] Support facebook-style query params in cases where a facet pivot is configured #3514
Conversation
…vot is configured each_with_object ignores the return value of the supplied block; you need to mutate the passed object instead. Prior to this change, the ramifications of bug are that: * FilterField#permitted_params always includes empty hashes (the original, unmutated object we passed to each_with_object) for a facet pivot field. * When Blacklight::Parameters::deep_merge_permitted_params comes across empty hashes, it discards a present hash in favor of the empty one. * As the permitted params for all facet fields are merged together, the presence of even one facet pivot field leads us to discard all other permitted facet field keys. * We have empty hashes, rather than hashes with permitted facet keys going into Blacklight::Parameters#deep_unmangle_params! * Blacklight::Parameters#deep_unmangle_params! can find no permitted parameters that it needs to unmangle, so the facebook params never get unmangled, causing errors and unexpected behavior elsewhere in the stack. * Facebook-style query params don't work if a facet pivot is configured. Co-authored-by: Christina Chortaria <christinach@users.noreply.github.com>
3f84146
to
beec8f5
Compare
@@ -803,7 +803,7 @@ def export_as_mock | |||
end | |||
|
|||
it "is empty for empty result sets", :integration do | |||
get :page_links, params: { f: { "format" => 'empty-result-set' }, counter: 1 } | |||
get :page_links, params: { f: { "format" => ['empty-result-set'] }, counter: 1 } |
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.
Correcting the structure of the params
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.
Thanks @sandbergja! Looks good. I appreciate all the tests, and the debugging - looks like it was pretty tricky to figure out what was going on!
ooh this is prob a good candidate for a backport. Bad one! Thank you for finding and fixing! |
…vot is configured (#3514) each_with_object ignores the return value of the supplied block; you need to mutate the passed object instead. Prior to this change, the ramifications of bug are that: * FilterField#permitted_params always includes empty hashes (the original, unmutated object we passed to each_with_object) for a facet pivot field. * When Blacklight::Parameters::deep_merge_permitted_params comes across empty hashes, it discards a present hash in favor of the empty one. * As the permitted params for all facet fields are merged together, the presence of even one facet pivot field leads us to discard all other permitted facet field keys. * We have empty hashes, rather than hashes with permitted facet keys going into Blacklight::Parameters#deep_unmangle_params! * Blacklight::Parameters#deep_unmangle_params! can find no permitted parameters that it needs to unmangle, so the facebook params never get unmangled, causing errors and unexpected behavior elsewhere in the stack. * Facebook-style query params don't work if a facet pivot is configured. Co-authored-by: Christina Chortaria <christinach@users.noreply.github.com>
each_with_object
ignores the return value of the supplied block; you need to mutate the passed object instead.Prior to this change, the ramifications of bug were that:
FilterField#permitted_params
always includes empty hashes (the original, unmutated object we passed toeach_with_object
) for a facet pivot field.Blacklight::Parameters::deep_merge_permitted_params
comes across empty hashes, it discards a present hash in favor of the empty one.Blacklight::Parameters#deep_unmangle_params!
Blacklight::Parameters#deep_unmangle_params!
can find no permitted parameters that it needs to unmangle, so the facebook params never get unmangled, causing errors and unexpected behavior elsewhere in the stack.Closes #3512