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
jorgefilipecosta merged 1 commit into master from fix/gallery-crashes-on-contributor-roles
Dec 11, 2019
Merged
Fix: Gallery crashes on contributor roles #19060
jorgefilipecosta merged 1 commit into master from fix/gallery-crashes-on-contributor-roles
Dec 11, 2019
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
jorgefilipecosta added [Type] Bug
An existing feature does not function as intended
[Block] Gallery
Affects the Gallery Block - used to display groups of images
labels
Dec 11, 2019
jorgefilipecosta requested review from ajitbohra, Soean and talldan as code owners
December 11, 2019 11:35
jorgefilipecosta deleted the fix/gallery-crashes-on-contributor-roles branch
December 11, 2019 12:27
jorgefilipecosta added a commit that referenced this pull request
Dec 11, 2019
if ( Platform.OS === 'web' && every( images, ( { url } ) => isBlobURL( url ) ) ) { | ||
if ( | ||
Platform.OS === 'web' && | ||
images && images.length > 0 && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Gallery
Affects the Gallery Block - used to display groups of images
[Type] Bug
An existing feature does not function as intended
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.
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.