wpcom-admin-bar: add Emails, Plugins, and Themes links#49822
wpcom-admin-bar: add Emails, Plugins, and Themes links#49822StevenDufresne wants to merge 8 commits into
Conversation
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! |
Code Coverage SummaryCoverage changed in 1 file.
Full summary · PHP report · JS report If appropriate, add one of these labels to override the failing coverage check:
Covered by non-unit tests
|
a8a3626 to
505c7fd
Compare
Mirror the Calypso masterbar W-menu in the wp-admin admin bar: - Resolve the user's hosting dashboard enrollment server-side from the `hosting-dashboard-opt-in` preference (read locally on Simple, via /me/preferences on Atomic), cached per user. - Enrolled: Emails and Plugins point to my.wordpress.com. - Not enrolled: Plugins points to classic Calypso; Emails is hidden. - Themes always opens classic wordpress.com/themes in a new tab. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The per-user transient could serve a stale pre-opt-in value for up to an hour, so a user who opted into the hosting dashboard would not see the updated menu (Emails link, my.wordpress.com Plugins) until the cache expired. Resolve the preference fresh on each render instead. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
On Atomic the enrollment lookup calls /me/preferences, which the admin bar would otherwise hit on every render. Cache the per-user result in a transient for an hour, matching the help-center per-user preference cache. Opt-in changes propagate within the hour. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Themes opens classic Calypso in a new tab but had no external indicator. Render a trailing external arrow (gridicons "external", at reduced opacity) on the node, matching the Calypso masterbar's ExternalLink. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Use a plain ↗ character in the node title instead of an icon, marking the Themes sub-item as opening classic Calypso in a new tab. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add a thin diagonal arrow (↗) to the Themes sub-item as a decorative
::after mask icon rather than link text, so it stays out of the
accessibility tree and mirrors correctly under [dir="rtl"].
The icon inherits the link color (color: inherit + background-color:
currentColor) to remain admin-color-scheme aware. color: inherit is
required to beat the WP 6.8 "modern" color scheme rule
`#wpadminbar:not(.mobile) li:hover .ab-item::after { color }` (a verbatim
core port from #42462 / core #62219), which otherwise tints the arrow
accent-blue whenever the parent (W) menu is hovered open.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
c6d5814 to
51af15a
Compare
| } | ||
| } | ||
|
|
||
| $enrolled = in_array( $opt_in_value, array( 'opt-in', 'forced-opt-in' ), true ); |
There was a problem hiding this comment.
How can we handle users who are in rollout cohort? I guess there is no way...
There was a problem hiding this comment.
Yeah... you're right... the logic is only in Calypso side...
There was a problem hiding this comment.
Hmm... do i reproduce the logic here? It's simple enough....
There was a problem hiding this comment.
the problem is the flag is not synced... maybe we should handle rollout cohort in backend 🤔
Add a test for the IS_WPCOM (Simple) preference-read path via a get_user_attribute stub. Mark the Atomic remote-request block @codeCoverageIgnore — it's signed I/O over Connection\Client, exercised in the connection package and not reliably mockable here. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Related to DOTMSD-1338
Related to Automattic/wp-calypso#111871.
Proposed changes
The WordPress.com logo menu in the wp-admin admin bar only offered Sites and Domains, while the Calypso masterbar's equivalent menu also has Emails, Plugins, and Themes. This brings the admin bar in line.
Where the new links point depends on whether the user's default WordPress.com experience is the hosting dashboard (their hosting dashboard opt-in preference):
The preference is read locally on Simple sites and from the user's WordPress.com preferences on Atomic.
Screenshots
Considerations
Related product discussion/links
Does this pull request change what data or activity we track or use?
No. It reads an existing user preference to decide link destinations; no new tracking.
Testing instructions
wpcom_admin_bar_hosting_dashboard_enrolledfilter), open wp-admin and click the WordPress.com logo. Confirm the menu shows Sites, Domains, Emails, Plugins, Themes, with Emails/Plugins pointing to my.wordpress.com and Themes opening wordpress.com/themes in a new tab.🤖 Generated with Claude Code