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

utils: mediaUpload: Pass all available properties in the media object #9704

Merged
merged 2 commits into from Oct 4, 2018

Conversation

Projects
None yet
2 participants
@jorgefilipecosta
Member

jorgefilipecosta commented Sep 7, 2018

Description

Initially, mediaUpload util only passed to the callback function of the invoker a simple object with the URL of the file, a caption, and an alt. With time needs for other props appeared and the function was changed to add the missing props. The most recent need was mediaDetails.sizes.
Now with the most recent updates in #9416 I discovered I need yet another property the media type.
I thought a little bit and I think the function should return all the available properties. Omitting props will limit the things blocks can do and will probably force them to use their own media upload if they really need a prop we are omitting.

How has this been tested?

I checked that blocks where we upload files (image, gallery, video, audio and file) the uploads still work as before.

Required for: #9416

@jorgefilipecosta jorgefilipecosta added this to the 4.0 milestone Sep 14, 2018

@jorgefilipecosta jorgefilipecosta requested a review from WordPress/gutenberg-core Sep 26, 2018

@gziolo

gziolo approved these changes Oct 4, 2018

It works well in my testing. I left a comment which offers another refactoring for picking properties, to remove a few keystrokes. It's not a blocker, take your own judgment.

Show outdated Hide outdated packages/block-library/src/gallery/edit.js Outdated

@jorgefilipecosta jorgefilipecosta merged commit 638605c into master Oct 4, 2018

2 checks passed

codecov/project 49.28% (-0.01%) compared to a3e1058
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@jorgefilipecosta jorgefilipecosta deleted the update/pass-all-object-properties-in-media-upload branch Oct 4, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment