This repository has been archived by the owner on Feb 22, 2023. It is now read-only.
Use the correct list of filters for All content #844
Merged
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.
Description
This PR fixes the mixup between the
mediaFilterKeys
andmediaSpecificFilters
objects in thesearch
store.The first is used to keep all the filter types that are used for the content type, and the second has a list of filters that are only used for the specific content type, and not used in other content types (such as
duration
for audio).One of the places where the
mediaSpecificFilters
was used was thesearch/CLEAR_OTHER_MEDIA_TYPE_FILTERS
. This action is dispatched when changing a content type to clear filters that do not apply to current content type. So, when changing from "All Content" to "Images", it would set all the filters that are specific for "All Content" and "Audio" to not checked. With the bug that is fixed here, it would also uncheck the following filters:['licenses', 'licenseTypes', 'searchBy', 'mature']
. And becausemature
filter is not an object, but a boolean, it would crash when iterated over, as thestate.filters['mature']
is not an array here, so we can't usemap
here:This did not actually cause an crash because we were only clearing the
supportedMediaTypes
, and not thesupportedContentTypes
(i.e. did not includeALL_MEDIA
).Testing Instructions
Simply running the unit and e2e tests should be enough.
Checklist
Update index.md
).main
) or a parent feature branch.Developer Certificate of Origin
Developer Certificate of Origin