-
Notifications
You must be signed in to change notification settings - Fork 826
Jetpack: optimize the way we initialize ToS #39286
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
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 🤖 The e2e test report can be found here. Please note that it can take a few minutes after the e2e tests checks are complete for the report to be available. Follow this PR Review Process:
Still unsure? Reach out in #jetpack-developers for guidance! Jetpack plugin: The Jetpack plugin has different release cadences depending on the platform:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. |
54499d0
to
854f57c
Compare
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.
Tests well for me! Left a couple of questions from reviewing the code.
public function wp_login_failed() { | ||
_deprecated_function( __METHOD__, '$$next-version$$' ); |
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.
I'm not entirely sure how we integrate with wp_login_failed
elsewhere, but it looks like there's a few other places where we use do_action
or add_action
with wp_login_failed
. Would removing it here have any affect on those use-cases?
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.
I've now realized it's an existing WordPress hook, but I'm still not too familiar with how it's used elsewhere in the monorepo and whether this version would attempt to be used. For example in class-sso.php
, we import the Tracking class, so would the use-cases in that file attempt to use this wp_login_failed
function over the WP hook? I'm guessing probably not as we'd need to explicitly use the Tracking class version in class-sso.php
- but just wanted to double check.
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.
Thanks for taking a look!
I agree, it is a bit confusing due to the function having same name as the hook.
Essentially, this is a WP hook that may or may not have any functions attached to it.
But since we're not removing the hook, they won't be affected.
We only remove this particular function attached to the hook.
Its only purpose was to track failed logins, but that Tracks event has been blocked on our servers for years, so this code is now useless: pdWQjU-QN-p2#comment-918
In class-sso.php
we run the wp_login_failed
action because we try to imitate the login failure the same way WP Core does it. That functionality shouldn't be affected by the change.
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.
Got it, thanks for explaining :)
Co-authored-by: Karen Attfield <karenlattfield@gmail.com>
oh amazing. I missed this one! |
Optimize the way we initialize ToS component. --------- Co-authored-by: Karen Attfield <karenlattfield@gmail.com>
Proposed changes:
Tracking of Jetpack-the-plugin events is initialized on-demand via
do_action( 'jetpack_initialize_tracking' )
.The action will first check if tracking is allowed to be initialized.
Other information:
Jetpack product discussion
pdWQjU-QN-p2#comment-918
https://github.com/Automattic/vulcan/issues/503
Does this pull request change what data or activity we track or use?
We modify the way we initialize tracking, but do not add or remove any tracking events.
Testing instructions:
jetpack_tos_agreed
option (wp option update jetpack_tos_agreed 1
)./jetpack/src/class-tracking.php
, find theinit()
method and add the following code beforestatic::$initialized = true;
:debug.log
stays empty.Jetpack Tracking initialized
line shows up indebug.log
(there'll be a few due to API requests).https://your-site.example/?rest_route=%2Fjetpack%2Fv4%2Fconnection
), confirm new log entry gets added.