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

Updater picker empty list message to match media type #16050

Merged
merged 8 commits into from
Apr 4, 2022

Conversation

jhnstn
Copy link
Member

@jhnstn jhnstn commented Mar 4, 2022

Fixes wordpress-mobile/gutenberg-mobile#3167

To test:
0. Choose a site with no media in the WordPress media library

  1. Open up the editor and add one of each blocks to a post: Image, Video, Audio and Media
  2. For each block try adding a file from the "WordPress Media Library"
  3. Verify that the empty media message matches the block type i.e. Image block -> "You don't have any images", etc
  4. Open the post on a device with no media ( such as an emulator )
  5. For each block try adding a file via "Choose from device"
  6. Verify that the empty media message matches the block type.

Regression Notes

  1. Potential unintended areas of impact
    This touches how the media picker collects files and could impact non empty file systems

  2. What I did to test those areas of impact (or what existing automated tests I relied on)
    I tried the picker on sites with and with out media

  3. What automated tests I added (or what prevented me from doing so)
    None were added.

PR submission checklist:

  • I have completed the Regression Notes.
  • 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.

@peril-wordpress-mobile
Copy link

peril-wordpress-mobile bot commented Mar 4, 2022

Warnings
⚠️ PR is not assigned to a milestone.

Generated by 🚫 dangerJS

@peril-wordpress-mobile
Copy link

peril-wordpress-mobile bot commented Mar 4, 2022

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

@jhnstn jhnstn requested review from SiobhyB and mchowning March 4, 2022 17:10
@peril-wordpress-mobile
Copy link

peril-wordpress-mobile bot commented Mar 4, 2022

You can test the changes on this Pull Request by downloading the APKs:

Copy link
Contributor

@mchowning mchowning left a comment

Choose a reason for hiding this comment

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

Just a few small issues, but nothing major, so I'll go ahead and give a 👍 because this worked great in my testing. Thanks Jason! 🙇

I did notice that this is a slightly different approach to how this is handled in the MediaGallery Fragment, which uses MediaFilters. I think that's fine because I like how simple this implementation is, but I wanted to at least call it out since it's always nice to use the same approach when possible.

@@ -152,6 +154,7 @@ data class MediaLoader(

data class DomainModel(
val domainItems: List<MediaItem> = listOf(),
val mediaTypes: Set<MediaType>? = null,
Copy link
Contributor

Choose a reason for hiding this comment

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

Unless we want a null value for mediaTypes to be distinguishable/treated-differently from from an "empty set" of mediaTypes, I would be inclined to not allow this parameter to be null (i.e., to change it from Set<MediaType>? to Set<MediaType>) and to instead use emptySet() anywhere it would be null.

I just like to disallow null values if it makes sense. What you have now is fine though, and I think this falls in the realm of personal preference, so feel free to leave it as-is if you prefer.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm probably not as nullphobic as I should be but there might be a reason for this to be null. That might however be an artifact from when I was trying to figure out the new interface to hold the mediaTypes. I'm guessing I can switch this out to use an emptySet

Plus update per feedback
@jhnstn jhnstn merged commit 298ef53 into trunk Apr 4, 2022
@jhnstn jhnstn deleted the update/picker-empty-list-message branch April 4, 2022 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Audio Block: Having no audio files results in "You don't have any media" message
2 participants