WIP - Add MediaUploadCheck component #9298
Closed
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.
Work in progress - not quite ready for review yet.
Description
Introduces a MediaUploadCheck component, which can be used to wrap other components and prevent them from rendering if a user does not have adequate permissions (e.g. Contributor roles) to upload files/media. This is implemented in our MediaPlaceholder component and several media blocks (image, video, audio etc.)
Currently this is hard-coded so that users won't see any change. A second PR will be created in a moment adding the checks for the user's capabilities.
These changes were originally implemented in #4155, but have been split into a separate PR to make them easier to review.
Related to issue #3672
Massive thanks to @imath for all the hard work he's put in developing this.
How has this been tested?
Screenshots
Screenshot of how media blocks would appear to users without capabilities
Types of changes
New feature (non-breaking change which adds functionality)
Checklist: