Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Post author dropdown missing users when number of users exceeds 100 #4622

Closed
ghost opened this issue Jan 21, 2018 · 15 comments
Closed

Post author dropdown missing users when number of users exceeds 100 #4622

ghost opened this issue Jan 21, 2018 · 15 comments
Labels
[Feature] Document Settings Document settings experience [Priority] High Used to indicate top priority items that need quick attention REST API Interaction Related to REST API [Type] Bug An existing feature does not function as intended

Comments

@ghost
Copy link

ghost commented Jan 21, 2018

Issue Overview

Author dropdown does not show all users.

Steps to Reproduce (for bugs)

  1. WordPress 4.9.2, Gutenberg 2.0.0
  2. 120 users
  3. Edit post
  4. Open author dropdown

Expected Behavior

List of 120 users

Current Behavior Gutenberg

List of 100 users

Current Behavior Classic Editor

List of 120 users

Possible Solution

Use X-WP-TotalPages and/or X-WP-Total headers in REST API response to get missing users.

@danielbachhuber
Copy link
Member

@TKES A couple follow-up questions to clarify:

  1. Just to confirm, does the WordPress user have access to list all 120 users?
  2. How did you verify only 100 users were present? Did you scroll through the entire list?

Thanks!

@danielbachhuber danielbachhuber added [Type] Bug An existing feature does not function as intended [Status] Needs More Info Follow-up required in order to be actionable. labels Jan 22, 2018
@ghost
Copy link
Author

ghost commented Jan 22, 2018

  1. User has administrator role.
  2. By looking at list, scrolling through list, looking at releated REST API request.

@danielbachhuber danielbachhuber changed the title Author dropdown missing users Post author dropdown missing users when number of users exceeds 100 Jan 22, 2018
@danielbachhuber danielbachhuber removed the [Status] Needs More Info Follow-up required in order to be actionable. label Jan 22, 2018
@danielbachhuber
Copy link
Member

Thanks @TKES — appreciated.

@danielbachhuber danielbachhuber added the [Feature] Document Settings Document settings experience label Jan 22, 2018
@spencerfinnell
Copy link

@danielbachhuber
Copy link
Member

@spencerfinnell Correct. wp/v2/users has a per_page cap of 100 items. We'd either need to:

  1. Traverse all pages to load all potential items.
  2. Show "common" users by default and permit some search auto-complete to get to the unlisted users.

@ghost
Copy link
Author

ghost commented Jan 22, 2018

@danielbachhuber The only acceptable solution is 1.

Similar code will be required anyway to fix #4632, #4623 and more issues like missing tag entries, missing custom taxonomy entries, etc.

And the hardcoded ? in REST API call needs to be fixed as well, it won't work with plain permalinks, as explained here by @bobbingwide

@danielbachhuber
Copy link
Member

Another idea would be to load the initial set of users when Gutenberg loads, and then progressively load all remaining users when the UI element is focused.

@danielbachhuber danielbachhuber added the REST API Interaction Related to REST API label Jan 23, 2018
@ghost
Copy link
Author

ghost commented Jan 23, 2018

@danielbachhuber "Another idea" would fail. If real author is not in initial set of users, saving the post without focusing UI element would still unintentionally change its author.

@adamsilverstein
Copy link
Member

What about adding a (debounced) search feature here so you could start typing the username and drill down to the correct user?

@bobbingwide
Copy link
Contributor

Some other things to note:

  • The response can contain many users who couldn't possibly be the Author of the post. e.g. Subscribers.
  • IMO the original request should include a filter to eliminate unwanted results.
  • Also, there's a lot of data that's not going to be used.
  • The final post author select list only uses the ID and display_name fields.

@StuartFeldt
Copy link
Contributor

So is the need here to add some sort of pagination/traverse options to withAPIData?

@robbiet480
Copy link

robbiet480 commented Mar 12, 2018

As an alternative, could the query params include roles=editor,administrator,author,contributor? The only reason we hit the 100 user limit is because of push notification subscribers...

@jeffpaul
Copy link
Member

This ticket was mentioned in Slack in #core-editor by jeffpaul. View the logs.

@lkraav
Copy link

lkraav commented Mar 19, 2018

2.4.0: I just attempted monkey-patching the query to test for .level_10 but for some reason still seeing everybody irrelevant.

@adamsilverstein
Copy link
Member

adamsilverstein commented Apr 1, 2018

Pushed a proposed fix that changes the selector into a searchable dropdown in #5921.

Worth noting the existing classic editor selector dropdown also has some scalability issues, especially when you get to thousands of users which isn't at all uncommon for WordPress sites. This trac ticket covers the discussion which includes mention of a search picker like the one included on the PR:

https://core.trac.wordpress.org/ticket/19867

@karmatosed karmatosed removed this from the Merge Proposal milestone Apr 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Document Settings Document settings experience [Priority] High Used to indicate top priority items that need quick attention REST API Interaction Related to REST API [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

9 participants