Skip to content

Use alternate source for embedding author data in internal notes#463

Closed
coreymckrill wants to merge 3 commits intotrunkfrom
try/author-embed
Closed

Use alternate source for embedding author data in internal notes#463
coreymckrill wants to merge 3 commits intotrunkfrom
try/author-embed

Conversation

@coreymckrill
Copy link
Copy Markdown
Contributor

@coreymckrill coreymckrill commented Mar 25, 2022

Currently the Internal Notes plugin retrieves embedded data about note authors using the standard wp/v2/users endpoint. However, this endpoint returns nothing if the specified user isn't a member of the site (which is most users on the Pattern Directory). This replaces that embeddable link with a wporg-specific endpoint that can get the data on any wporg user, regardless of site membership.

Depends on:

Screenshots

Before After
before after

How to test the changes in this Pull Request:

  1. Upload this change to your sandbox
  2. Try viewing the Internal Notes sidebar for any pattern

@coreymckrill coreymckrill added the [Component] Pattern Directory The backend of the pattern directory: submission, management, etc label Mar 25, 2022
@coreymckrill coreymckrill self-assigned this Mar 25, 2022
@coreymckrill coreymckrill requested a review from ryelle March 29, 2022 20:48
@coreymckrill coreymckrill marked this pull request as ready for review March 29, 2022 20:48
/**
* Actions and filters.
*/
add_filter( 'wporg_internal_notes_rest_prepare_response', __NAMESPACE__ . '\replace_rest_controller_author_link' );
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why not make this change in the internal notes plugin itself?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good question. I originally thought of putting it there, but decided it would be best to keep the functionality in the plugin as environment-neutral as possible (which was inspired by @dd32 mentioning that he had tried using the plugin elsewhere on an external site). That said, all uses of the Internal Notes plugin I can think of within wporg would probably need this same modification, so perhaps this would be better somewhere in mu-plugins?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Oh, I misread the endpoint namespace change in WordPress/wporg-internal-notes#12, and thought it was already using wporg endpoints. Since it's not designed for wporg-only, I take back my comment :)

all uses of the Internal Notes plugin I can think of within wporg would probably need this same modification, so perhaps this would be better somewhere in mu-plugins?

Yeah, that makes sense to me.

coreymckrill added a commit to WordPress/wporg-mu-plugins that referenced this pull request Mar 30, 2022
The main mu-plugins directory on wporg is cluttered with files that are
for one or more "tweaks" to a particular plugin. The goal with this PR
is to not proliferate the same pattern in our pub-sync mu-plugins by
stashing all such tweaks in a "plugin-tweaks" subdirectory. Eventually
we could also clean up the main mu-plugins directory by migrating
open-sourcable tweaks to this new place.

The first tweak for this new system is for the Internal Notes plugin. It
started out as [a
PR](WordPress/pattern-directory#463) for the
pattern directory, but after some discussion it seems better to put it
in mu-plugins since it will benefit any use of the Internal Notes plugin
anywhere on wporg.

Note that with this PR I haven't moved the existing "stream-tweaks" in
this repo into "plugin tweaks". This is because that particular tweak is
no longer needed, and will be removed in a separate PR.
@coreymckrill
Copy link
Copy Markdown
Contributor Author

Closing this in favor of WordPress/wporg-mu-plugins#192

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

Labels

[Component] Pattern Directory The backend of the pattern directory: submission, management, etc

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants