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

Editor: Use getAuthors for 'showCombobox' check #30218

Merged
merged 2 commits into from Apr 6, 2021

Conversation

@Mamaduka
Copy link
Contributor

@Mamaduka Mamaduka commented Mar 25, 2021

Description

The getUsers automatically adds context=edit which requires for the current user to have list_users capability.

Fixes #29845.

How has this been tested?

Test A:

  1. Create/edit a post with an editor role.
  2. You should not see 403 Forbidden error in the browser console for this endpoint - https://<site_url>/wp-json/wp/v2/users?who=authors&per_page=26&context=edit&_locale=user.

Test B:

  1. Generate authors - wp user generate --role=editor --count=50
  2. Create/edit a post with an editor role.
  3. You should see the Combobox component for author selection.

Cleanup: wp user delete $(wp user list --role=editor --field=ID).

Types of changes

Bugfix

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • I've tested my changes with keyboard and screen readers.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
  • I've updated all React Native files affected by any refactorings/renamings in this PR.
Copy link
Contributor

@youknowriad youknowriad left a comment

Mmmm Right, this makes sense. cc @adamsilverstein

Should we add a comment explaining the reasoning there?

@Mamaduka
Copy link
Contributor Author

@Mamaduka Mamaduka commented Apr 6, 2021

Thanks, @youknowriad, for the review.

Should we add a comment explaining the reasoning there?

Agree, make it easier to avoid similar regression in the future.

I will update the code and add the comment.

Mamaduka added 2 commits Mar 25, 2021
@Mamaduka Mamaduka force-pushed the Mamaduka:fix/editor-post-author branch from 37f8b71 to c521664 Apr 6, 2021
@gziolo gziolo added this to Needs Review in WordPress 5.7.x Must Haves via automation Apr 6, 2021
@gziolo gziolo merged commit fc3a5a1 into WordPress:trunk Apr 6, 2021
19 checks passed
19 checks passed
Bump version
Details
Cancel Previous Runs
Details
Check
Details
Checks (12)
Details
Admin - 1 Admin - 1
Details
Run performance tests
Details
test (gutenberg-editor-initial-html)
Details
test (12.2, gutenberg-editor-initial-html)
Details
All
Details
JavaScript (12)
Details
Checks (14)
Details
Admin - 2 Admin - 2
Details
JavaScript (14)
Details
Admin - 3 Admin - 3
Details
Admin - 4 Admin - 4
Details
Build Release Artifact
Details
PHP
Details
Create Release Draft and Attach Asset
Details
Mobile
Details
WordPress 5.7.x Must Haves automation moved this from Needs Review to Done Apr 6, 2021
@github-actions github-actions bot added this to the Gutenberg 10.4 milestone Apr 6, 2021
gziolo added a commit that referenced this pull request Apr 6, 2021
* Use getAuthors for 'showCombobox' check

* Add inline comment
@gziolo gziolo changed the title Use getAuthors for 'showCombobox' check Core Data: Use getAuthors for 'showCombobox' check Apr 6, 2021
@gziolo gziolo changed the title Core Data: Use getAuthors for 'showCombobox' check Editor: Use getAuthors for 'showCombobox' check Apr 6, 2021
gziolo added a commit that referenced this pull request Apr 6, 2021
* revert #27717 (#30524)

Co-authored-by: grzim <[email protected]>

* Use getAuthors for 'showCombobox' check (#30218)

* Use getAuthors for 'showCombobox' check

* Add inline comment

* Gallery: Set 'addToGallery' prop to false when images don't have IDs. (#30122)

This also sets MediaPlaceholder value to an empty object. With both props set to "falsy" values, the gallery media frame is initialized in the "Create Gallery" state. This lets users replace placeholder images from patterns.

Co-authored-by: Grzegorz <[email protected]>
Co-authored-by: grzim <[email protected]>
Co-authored-by: George Mamadashvili <[email protected]>
@Mamaduka Mamaduka deleted the Mamaduka:fix/editor-post-author branch Apr 6, 2021
ntsekouras added a commit that referenced this pull request Apr 7, 2021
* revert #27717 (#30524)

Co-authored-by: grzim <[email protected]>

* Use getAuthors for 'showCombobox' check (#30218)

* Use getAuthors for 'showCombobox' check

* Add inline comment

* Gallery: Set 'addToGallery' prop to false when images don't have IDs. (#30122)

This also sets MediaPlaceholder value to an empty object. With both props set to "falsy" values, the gallery media frame is initialized in the "Create Gallery" state. This lets users replace placeholder images from patterns.

Co-authored-by: Grzegorz <[email protected]>
Co-authored-by: grzim <[email protected]>
Co-authored-by: George Mamadashvili <[email protected]>
@adamsilverstein
Copy link
Member

@adamsilverstein adamsilverstein commented Apr 7, 2021

Nice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment