Automattic / wp-calypso

The JavaScript and API powered WordPress.com
https://developer.wordpress.com
GNU General Public License v2.0
12.41k stars 1.98k forks source link

Reusable blocks: author/contributor roles cannot see any reusable blocks including ones created by them #49634

Open worldomonation opened 3 years ago

worldomonation commented 3 years ago

Steps to reproduce the behavior

Prereq. Logged in as Author or Contributor user.

  1. Create a new post.
  2. Add a block on page.
  3. Click on Toolbar > Hamburger Menu > Add to Reusable Blocks.
  4. Click on Add Block on top left of the masterbar.
  5. Click on Reusable tab.
  6. Scroll down to bottom and click on Manage all reusable blocks.

What I expected to happen

User is able to view and manage reusable blocks they have created.

What actually happened

User is unable to view any reusable blocks, even ones they have created.

Context

User scenario #manual-testing.

Browser / OS version

Browser: Safari Version 14.0.2 (16610.3.7.1.9) Browser: Firefox Nightly 87.0a1 OS: macOS Big Sur 11.1 (20C69)

Is this specific to the applied theme? Which one?

N/A

Does this happen on simple or atomic sites or both?

Tested on Simple. Untested on Atomic.

Is there any console output or error text?

No

Level of impact (Does it block purchases? Does it affect more than just one site?)

Minor - user must request someone with higher access (eg. Administrator) to modify the blocks for them.

Screenshot / Video: If applicable, add screenshots to help explain your problem.

Screen Shot 2021-02-02 at 4 03 16 PM https://user-images.githubusercontent.com/6549265/106679358-52cfec00-6571-11eb-8525-0ad66d6fe8e6.mov

simison commented 3 years ago

@worldomonation Is this happening in stock Gutenberg as well? If it is, https://github.com/WordPress/gutenberg would be better repo for issue.

worldomonation commented 3 years ago

@worldomonation Is this happening in stock Gutenberg as well? If it is, https://github.com/WordPress/gutenberg would be better repo for issue.

Yes, I can reproduce it on jurassic.ninja as well. I'll report this at Gutenberg.

Sorry, not enough coffee + first thing in the morning. This issue does not appear reproducible on jurassic.ninja.

As an Author type user, I was able to view the reusable blocks I had created.

obenland commented 3 years ago

Are they accessible from wp-admin? [Edit] They are

obenland commented 3 years ago

The wpcom/v2/sites/BLOG_ID/post-counts/wp_block request returns the correct number but the post request returns an empty result. I wonder if the capabilities are not mapped correctly in the post type registration.

obenland commented 3 years ago

FWIW Contributors by design don't have the caps to create/manage reusable blocks, but I was able to reproduce it for an Author level user.

obenland commented 3 years ago

It looks like our API has a problem with non-public post types being accessed. Using wp/v2/sites/BLOG_ID/blocks works fine, maybe we should switch to that in Calypso.

simison commented 3 years ago

@fullofcaffeine @WunderBart hi! This seems like a good Gutenberg integration issue to tackle by Team Calypso — what do you think?