Skip to content

"upload_files" capability and Image relative blocks #3672

@imath

Description

@imath

Issue Overview

Gutenberg version 1.7.0
When a contributor uses Gutenberg he can use Image relative blocks. When he tries to use it as this role hasn't got the upload_files capability, the REST reply to site.url/wp-json/wp/v2/media is rest_cannot_create (403).

Steps to Reproduce (for bugs)

  1. Log in as a contributor.
  2. Add a new post.
  3. Select the image block.
  4. Upload an image.
  5. The image shows for a few milliseconds.
  6. The Upload/Browse buttons are replacing the vanished image.
  7. No feedback is provided to the contributor untill the automatic save feature run. Then the error is: "This block has encountered an error and cannot be previewed."

Chrome Version 62.0.3202.94

Expected Behavior

Image/files relative blocks should only show if ( current_user_can( 'upload_files' ) )

Current Behavior

Image/files relative blocks are showing no matter the "upload_files" capability of the logged in user.

Possible Solution

Screenshots / Video

Here is some oxygen 😉 https://cldup.com/K8qYyaHWbI.mp4

Related Issues and/or PRs

Todos

  • Tests
  • Documentation

Metadata

Metadata

Assignees

No one assigned

    Labels

    REST API InteractionRelated to REST API[Feature] MediaAnything that impacts the experience of managing media[Status] In ProgressTracking issues with work in progress

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions