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

Sidebar Plugin for Block Editor Integration #790

Merged
merged 111 commits into from
Apr 19, 2022

Conversation

laras126
Copy link
Contributor

@laras126 laras126 commented May 14, 2021

Overview

This PR includes the addition of a panel in the Document sidebar in Gutenberg that provides the Co-Authors Plus functionality. There are a few things still to do, but I wanted to open this up now to start getting feedback.

  • A WP API endpoints to retrieve, save, and search coauthors using existing methods
  • Use of the Combobox block editor component for the UI, including the autocomplete
  • A data store to manage the Co-Authors state so we can access the data locally and globally
  • A filter to enable the block editor integration, that is set to false by default
  • Hide core author meta box by updating the _links entry in the response (To Do)

Screenshots

Video of adding, removing, and re-ordering Co-Authors using the Sidebar panel.

coauthors-sidebar-plugin.mp4

How to Test This PR

  1. Pull down this branch for the coauthors plugin in a local WordPress development environment.
  2. Create a few Guest Authors.
  3. Add a new post.
  4. Observe that the Co-Authors meta box does not display in the editor.
  5. Observe the default Author selection in the "Status & Visibility" sidebar panel does not display.
  6. Observe the "Authors" panel added to the sidebar.
  7. Observe the current user is assigned as the default author in the "Authors".
  8. Search for the name of another author in the auto-complete section in the Authors panel and add it.
  9. Do the same for a few other authors. Using the side buttons, remove and move the authors up and down.
  10. Make sure the Update button is activated when only the authors are changed and no other changes have been made.
  11. Save the post and confirm the authors and their order has been saved by reloading the screen.

@laras126
Copy link
Contributor Author

laras126 commented Mar 18, 2022

Hi @lschuyler – I updated the PR with the following changes and updated the PR comment for the steps to test the feature accordingly:

  • Made feature the default and removed opt-in logic (much better!)
  • Fixed failing tests (though I am only running these tests locally and not seeing the result from when they are run in the CI) - Update: I see the CI results and will fix this failure next.
  • Added sanitize_email to the returned email in the endpoint (lmk if another escaping function is preferred)

Happy to address anything else you see. Thank you!

co-authors-plus.php Outdated Show resolved Hide resolved
@laras126 laras126 requested a review from lschuyler April 4, 2022 14:03
lschuyler
lschuyler previously approved these changes Apr 14, 2022
Copy link
Contributor

@lschuyler lschuyler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great @laras126. The tests are all passing for me now too.
Thanks for all your work here!
We'll get this merged and released.

@rebeccahum rebeccahum added this to the 3.5 milestone Apr 19, 2022
* Block editor functionality in the sidebar is
* disabled by default.
*/
const SIDEBAR_PLUGIN_ENABLED = false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the purpose of this constant?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is outdated! Good catch – I'll update it momentarily.

@rebeccahum
Copy link
Contributor

Thank you so much for your work on this, @laras126! I've added just two minor comments and then we should be good to go.

@GaryJones
Copy link
Contributor

@lschuyler @rebeccahum @laras126 Was there any consideration of the escaping that seems to be done here? How could the REST Response know what context the escaping would need to be done with? (Possibly causing #937)

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

Successfully merging this pull request may close these issues.

6 participants