web-stories-wp: Dashboard: author does not see drafts

Bug Description

If I log in to an established wordPress account as a user with no stories of my own but another user has created stories, those stories aren’t showing up in “my stories” (because they aren’t mine) however the header counts for existing stories are showing with the number of stories that exist for that other user.

Screen Shot 2021-03-04 at 8.26.33 AM.png

Expected Behaviour

If I have no stories that are getting returned to me I would expect the story counts to all be 0 regardless of what other account users have created.

Steps to Reproduce

Log into a wordPress account that has stories created in it but as either a new users or a user with 0 stories authored by them, go to the dashboard. See header counts.

Additional Context

returned headers from web-stories/v1/web-story/ are: "headers":{"X-WP-Total":18,"X-WP-TotalPages":1,"X-WP-TotalByStatus":"{\"all\":20,\"publish\":0,\"future\":0,\"draft\":18,\"private\":2}"}}

  • Plugin Version:
  • WordPress Version:
  • Operating System:
  • Browser:

Do not alter or remove anything below. The following sections will be managed by moderators only.

Acceptance Criteria

That header counts are 0 when there are no stories to show.

Implementation Brief

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 1
  • Comments: 23 (11 by maintainers)

Most upvoted comments

Sorry a came a little late to this one. The dashboard does not seem to respect edit_others_posts or delete_others_posts use capabilities. See get_post_type_capabilities details for a list of capabilities.

Adding these capabilities to the config dashboard here

https://github.com/google/web-stories-wp/blob/3532692b15da22809e6e597367f252a8f18724e0/includes/Dashboard.php#L341-L347

https://github.com/google/web-stories-wp/blob/3532692b15da22809e6e597367f252a8f18724e0/includes/Dashboard.php#L372-L376

Once we have these in the config, we should check if a user can edit / delete others stories before displaying this options to the user.

It is worth noting the rest api response different from what is expected in the WP screen. The REST API only returns stories you can edit. The WP screen, puts placeholder lines, with no title so the number of results match lines in table. Compare these screenshots.

Screenshot 2021-03-08 at 12 15 22 Screenshot 2021-03-08 at 12 16 02

So what is the expected behavior?

  1. The number of drafts returned in API header, reflect the user that user can see?
  2. Or should we put a number of placeholder stories to fill out this screen so the numbers match?

IMO, I think option 1.

Sounds like we ( infra ) need to add some extra data to config for capabilities and add more logic to rest api to check for edit_others_posts and change the counts.

Still an issue. Seems possible it’s related to what @littlemilkstudio mentioned in #8532