-
Notifications
You must be signed in to change notification settings - Fork 819
Hides the Blaze badge on the Stats page when the feature is disabled #43048
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
base: trunk
Are you sure you want to change the base?
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! 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. Mu Wpcom plugin:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. Wpcomsh plugin:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. |
Code Coverage SummaryCoverage changed in 1 file.
|
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 @sbarbosa!
The code LGTM and works as advertised.
For next reviewers
Using a local Jetpack is not the best way to test this PR because when I tried it I wasn't able to bring views there even after waiting for significant amount of time and trying various devices (tried accessing a post from phone, using VPN and so on).
Instead, please use a one-time Jurassic Ninja site together with Beta Tester plugin (link) by putting a feature branch as on the image below.
Side note
Even though what I want to mention is far beyond this PR, it still should be mentioned.
I noticed that blaze icon is shown for posts but is not shown for pages as on a gif below.
@@ -40,6 +40,8 @@ public function get_data() { | |||
$blog_id = Jetpack_Options::get_option( 'id' ); | |||
$host = new Host(); | |||
|
|||
$can_blaze = class_exists( 'Automattic\Jetpack\Blaze' ) && \Automattic\Jetpack\Blaze::should_initialize()['can_init'] === true; |
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 see Phan static analysis gone mad and returned according error.

I found that there's a way to calm it a bit. Previously folks used this approach to make it happier: https://github.com/Automattic/jetpack/pull/41857/files
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.
Yes, I changed how I guard the code and explicitly use an if wrapper. I still had to add the blaze package in the composer.
I will update the ticket to mention that so I can get feedback from the Jetapck team if I need to solve that problem differently.
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.
tested using a jurrasic site and worked as described
code changes LGTM
Fixes Automattic/wp-calypso#101987
We are displaying the Blaze link on the Stats page when the Blaze feature is off; if users click it, they will end up on an invalid page. The main problem is that the site and user connection are now handled separately, and it's more common to land on this case. (Blaze needs both connections to work correctly).
Proposed changes:
Include the
can_blaze
flag as one of the initial parameters for the Jetpack Stats module (Odyssey app).Note for Reviewers: Because of a phan error, I had to include the blaze package as a dependency in the Stats. Please let me know if there are different ways to do this. I guarded my code in case the stats module is working on a standalone solution.
Other information:
Jetpack product discussion
N/A
Does this pull request change what data or activity we track or use?
No
Testing instructions:
You will need to have a site with some stats, so try to access the posts a couple of times before starting the test.