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: Gallery crashes on contributor roles #19060

Merged
merged 1 commit into from Dec 11, 2019

Conversation

@jorgefilipecosta
Copy link
Member

jorgefilipecosta commented Dec 11, 2019

Description

Currently, the gallery block is crashing on contributor roles. This PR fixes this problem by ensuring the upload mechanism only executes if, in fact, we have images to upload.

How has this been tested?

With a contributor user, I added a gallery block and verified it does not crashes (although the user can not do anything).
I tried to drag & drop images to the editor and verified it was not possible.

@jorgefilipecosta jorgefilipecosta merged commit ee3e0b2 into master Dec 11, 2019
2 checks passed
2 checks passed
pull-request-automation
Details
Travis CI - Pull Request Build Passed
Details
@jorgefilipecosta jorgefilipecosta deleted the fix/gallery-crashes-on-contributor-roles branch Dec 11, 2019
if ( Platform.OS === 'web' && every( images, ( { url } ) => isBlobURL( url ) ) ) {
if (
Platform.OS === 'web' &&
images && images.length > 0 &&

This comment has been minimized.

Copy link
@aduth

aduth Dec 11, 2019

Member

Nitpick, but: If we spread a condition across multiple lines, each part should be on its own line:

- images && images.length > 0 &&
+ images &&
+ images.length > 0

There's meant to be guidance around this in the JavaScript coding standards. They appear to be out of date on the live site.

Archive: http://web.archive.org/web/20190412084124/https://make.wordpress.org/core/handbook/best-practices/coding-standards/javascript/

@youknowriad youknowriad added this to the Gutenberg 7.2 milestone Jan 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.