Use alternate source for embedding author data in internal notes#463
Use alternate source for embedding author data in internal notes#463coreymckrill wants to merge 3 commits intotrunkfrom
Conversation
| /** | ||
| * Actions and filters. | ||
| */ | ||
| add_filter( 'wporg_internal_notes_rest_prepare_response', __NAMESPACE__ . '\replace_rest_controller_author_link' ); |
There was a problem hiding this comment.
Why not make this change in the internal notes plugin itself?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
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.
|
Closing this in favor of WordPress/wporg-mu-plugins#192 |
Currently the Internal Notes plugin retrieves embedded data about note authors using the standard
wp/v2/usersendpoint. 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
How to test the changes in this Pull Request: