[Fix] Gutenberg - honor allowMultipleSelection js flag in StockMediaPicker #11912
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.
Fixes wordpress-mobile/gutenberg-mobile#2261
Description
When the user selects "Free photos library" from the Cover block, it allows multiple photos to be selected. This is inconsistent with the other upload options (which only allow a single image to be selected). Additionally, these selected images are all uploaded to the media library upon confirmation, but only the first selected image is displayed in the post.
This PR adds a new request code for starting the StockMediaPicker activity for single select mode. This is necessary because the existing request code used for this purpose (
RequestCodes.STOCK_MEDIA_PICKER_SINGLE_SELECT
) is assumed to be used for the featured image picker.Edit:
It turns out the issue that this PR fixes also exists for other blocks, and this PR fixes the issue for those blocks as well (e.g. Image, and Media & Text).
To test:
Expected behavior:
Only 1 image can be selected.
Steps:
Expected behavior
Selected image becomes the background of the Cover block
PR submission checklist:
RELEASE-NOTES.txt
if necessary.