Make WordPress Core

Opened 22 months ago

Last modified 20 months ago

#56429 new defect (bug)

Gutenberg author box missing

Reported by: lgadzhev's profile lgadzhev Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 6.0.1
Component: Editor Keywords: needs-patch has-testing-info
Focuses: javascript, administration, rest-api Cc:

Description

There is a bug related to the author box missing when all of the following conditions are true:

  • When there are more than 70 users in a WP installation
  • When an Editor creates a post and saves it as a draft. This must be the only post of that user
  • If all the users are ordered alphabetically, that user must be above 60 in the order

When this is true, if another Editor opens that draft, the author box won't be visible. There is an additional request that should fetch that user and it's returning error 403

If Administrator opens it, the author box is present

The cause for the bug is the last condition that fails here - https://github.com/WordPress/WordPress/blob/master/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php#L445 because the function checks for the author of the post

Change History (5)

#1 @SergeyBiryukov
22 months ago

  • Focuses rest-api added

This ticket was mentioned in Slack in #core-test by ironprogrammer. View the logs.


22 months ago

#3 @ironprogrammer
22 months ago

  • Keywords needs-testing-info added

Thank you for the report, @lgadzhev, and welcome to Trac!

Detailed steps to reproduce the issue would be very useful here.

Last edited 22 months ago by ironprogrammer (previous) (diff)

#4 @vabrashev
20 months ago

Will try to add the missing info:

Testing Instructions

These steps define how to reproduce the issue, and indicate the expected behavior.

Steps to Reproduce

  1. Log in to your local WP installation and create 100 "dummy" users with role Editor. If you have wp CLI enabled you can use this command for i in {1..100}; do wp user create editor${i} editor${i}@editor${i}.com --user_pass=editor${i} --role=editor; done. This will create 100 users with equal combination of username and password like "usernameN"/"passwordN", e.g. editor1/editor1, editor2/editor2, editor3/editor3, etc.
  2. Log in with user "editor1", create a new "Test Post" and set the Author to "editor99" (by searching in the input field) - https://i.imgur.com/Lxw1ybe.png
  3. 🐞 Log in in incognito mode or with a different browser with user "editor2" and open the very same post. You will notice that the Author post is not visible and you cannot change the Author - https://i.imgur.com/vG9QrTf.png

Expected Results

When testing a patch to validate it works as expected:

  • ✅ The Author box should always be visible whether it's in the first 50 users in the dropdown ordered alphabetically or not. Every editor should have the ability to see who's the author of the post and have the ability to change it.

When reproducing a bug:

  • ❌ The bug happens when inside a WP installation there are more than around 50 users. When a user enters the Block Editor, the author dropdown shows around 50 users max - https://nimb.ws/EtcaeH. You can freely use the dropdown search, even for editors but still, the initial load shows only around 50 users in the dropdown. Normally this is fetching the first users in alphabetical order. If the user is among the first 50 users, it's going to be shown as the author of the post and everything will be fine but if it's not, the Block Editor will make an additional call to fetch that specific user. Unlike the call that is used for the dropdown's search, this call returns more information about the user and requires some additional capabilities, which Editors as user role don't have and it's breaking the author box
Last edited 20 months ago by vabrashev (previous) (diff)

#5 @ironprogrammer
20 months ago

  • Keywords has-testing-info added; needs-testing-info removed
Note: See TracTickets for help on using tickets.