-
Notifications
You must be signed in to change notification settings - Fork 133
Add admin pointers to promote new Performance Lab features #2122
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
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## trunk #2122 +/- ##
==========================================
+ Coverage 67.22% 67.58% +0.36%
==========================================
Files 93 93
Lines 7758 7799 +41
==========================================
+ Hits 5215 5271 +56
+ Misses 2543 2528 -15
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
/** | ||
* @covers ::perflab_get_dismissed_admin_pointer_ids | ||
*/ | ||
public function test_perflab_get_dismissed_admin_pointer_ids(): void { | ||
$user_id = self::factory()->user->create( array( 'role' => 'administrator' ) ); | ||
wp_set_current_user( $user_id ); | ||
|
||
// No dismissed pointers. | ||
$this->assertSame( array(), perflab_get_dismissed_admin_pointer_ids() ); | ||
|
||
// Dismiss a single pointer. | ||
update_user_meta( $user_id, 'dismissed_wp_pointers', 'perflab-admin-pointer' ); | ||
$this->assertSame( array( 'perflab-admin-pointer' ), perflab_get_dismissed_admin_pointer_ids() ); | ||
|
||
// Dismiss multiple pointers. | ||
update_user_meta( $user_id, 'dismissed_wp_pointers', 'perflab-admin-pointer,another-pointer' ); | ||
$this->assertSame( array( 'perflab-admin-pointer', 'another-pointer' ), perflab_get_dismissed_admin_pointer_ids() ); | ||
|
||
// Dismiss all pointers. | ||
update_user_meta( $user_id, 'dismissed_wp_pointers', implode( ',', array_keys( perflab_get_admin_pointers() ) ) ); | ||
$this->assertSame( array_keys( perflab_get_admin_pointers() ), perflab_get_dismissed_admin_pointer_ids() ); | ||
} | ||
|
||
/** | ||
* @covers ::perflab_get_admin_pointers | ||
*/ | ||
public function test_perflab_get_admin_pointers(): void { | ||
$pointers = perflab_get_admin_pointers(); | ||
$this->assertArrayHasKey( 'perflab-admin-pointer', $pointers ); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: I'm happy to say that Gemini Code Assist was actually able to write most of this for me. In PhpStorm, I just did Cmd+\ and then entered /generate test perflab_get_dismissed_admin_pointer_ids
and then again for perflab_get_admin_pointers()
, and voilà!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@westonruter This is awesome, I really like the way you solved this with a single implementation that can handle separate pointer IDs per feature in a single pointer UI. 🎉
A few minor points of feedback, but it's almost good to go.
Co-authored-by: Felix Arntz <[email protected]>
Co-authored-by: Weston Ruter <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@westonruter LGTM! Looking forward to seeing this launch.
Summary
Fixes #1239
When activating the plugin for the first time, a simple generic admin pointer message is displayed about all the features and how they can be activated:
If someone has the plugin already active (and previously dismissed this
perflab-admin-pointer
pointer, then when other PerfLab pointers have not already been dismissed, then they'll appear in a new admin pointer:Two feature-specific admin pointers are introduced, one for the new View Transitions plugin and another for the new logged-in opt-in for the Speculative Loading plugin.
The logic for adding the admin pointer was also refactored, making use of inline scripts. This eliminated the need for the
perflab_render_pointer()
function.This PR also includes an Upgrade Notice for Performance Lab to also promote the View Transitions plugin, which was done previously for Image Prioritizer.