Skip to content
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

[Fix] Gutenberg - honor allowMultipleSelection js flag in StockMediaPicker #11912

Merged
merged 3 commits into from
May 14, 2020

Conversation

mkevins
Copy link
Contributor

@mkevins mkevins commented May 14, 2020

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:

  1. Create a new Gutenberg post
  2. Add a cover block
  3. Tap "Add image or video"
  4. Tap "Choose from Free Photo Library"
  5. Type a search term

Expected behavior:

Only 1 image can be selected.

Steps:

  1. Select an image
  2. Tap "Use this photo"

Expected behavior
Selected image becomes the background of the Cover block

PR submission checklist:

  • I have considered adding unit tests where possible.
  • I have considered adding accessibility improvements for my changes.
  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

@mkevins mkevins added Media Stock Photos Gutenberg Editing and display of Gutenberg blocks. labels May 14, 2020
@peril-wordpress-mobile
Copy link

peril-wordpress-mobile bot commented May 14, 2020

You can trigger optional UI/connected tests for these changes by visiting CircleCI here.

@peril-wordpress-mobile
Copy link

peril-wordpress-mobile bot commented May 14, 2020

You can test the changes on this Pull Request by downloading the APK here.

@pinarol pinarol requested a review from dratwas May 14, 2020 07:06
@mkevins mkevins added this to the 14.9 milestone May 14, 2020
Copy link
Contributor

@dratwas dratwas left a comment

Choose a reason for hiding this comment

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

Hi! I tested it and everything seems to work as expected, good job 🎉

  • Image - Upload from free photo library -> Allows only for single select
  • Media-Text - Upload from free photo library -> Allows only for single select
  • Cover - Upload from free photo library -> Allows only for single select
  • Gallery - Upload from free photo library -> Still allows for multi select

@mkevins mkevins merged commit d56fccd into develop May 14, 2020
@mkevins mkevins deleted the rnmobile/issue/2261-free-photos-single-picker branch May 14, 2020 21:31
@mkevins
Copy link
Contributor Author

mkevins commented May 14, 2020

Thanks for reviewing and testing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Gutenberg Editing and display of Gutenberg blocks. Media
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Android] Free Photo Library allows selecting / uploading multiple images, but only shows first one
2 participants